3 \�me7 � @ s U d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m Z mZmZm Z mZ ddlmZ ddlmZ ddlmZmZ dd lmZ dd lmZ dZedd ddddg�Zedg�ZdZdZdZ dZ!dZ"dZ#ddde dde#dddddd�Z$e%dg�Z&e%d d!d"d#d$d%d&g�Z'e%ej(e$j)� e&e'd'd(d)d*d+g��Z*d,Z+d-Z,ed.d/d0d1d2g�Z-eZ.d3gZ/ej0e1�Z2d4d5d6ed7�e/ed8�ge.d9gd:�Z3e3ee3�Z d;d<� Z4d=d>� Z5e6eee7dd?�d@dA�Z8dBdC� Z9ee7dD�dEdF�Z:dRedG�dHdI�Z;edJ�dKdL�Z<ee6 dM�dNdO�Z=dPdQ� Z>dS )Sz7Chef: module that configures, starts and installs chef.� N)�dedent)�List)�subp� temp_utils� templater� url_helper�util)�Cloud)�Config)� MetaSchema�get_meta_doc)�Distro)� PER_ALWAYSz1.8z /etc/chefz /var/log/chefz /var/lib/chefz/var/cache/chefz/var/backups/chefz /var/run/chefz#https://www.chef.io/chef/install.sh� z/etc/chef/validation.pemz#/etc/chef/encrypted_data_bag_secret�_defaultz/etc/chef/firstboot.jsonz:verify_nonez:infoz/var/log/chef/client.logz/etc/chef/client.pemz/var/run/chef/client.pidT)Zssl_verify_modeZ log_level�log_location�validation_key�validation_cert� client_key�json_attribs�file_cache_pathZfile_backup_path�pid_file� show_time�encrypted_data_bag_secretr r r r r r r r � server_url� node_name�environment�validation_nameZchef_licensez/etc/chef/client.rbz/usr/bin/chef-clientz-dz-iZ1800z-sZ20�allZcc_chefZChefz0module that configures, starts and installs chefa This module enables chef to be installed (from packages, gems, or from omnibus). Before this occurs, chef configuration is written to disk (validation.pem, client.pem, firstboot.json, client.rb), and required directories are created (/etc/chef and /var/log/chef and so-on). If configured, chef will be installed and started in either daemon or non-daemon mode. If run in non-daemon mode, post run actions are executed to do finishing activities such as removing validation.pem.a� chef: directories: - /etc/chef - /var/log/chef validation_cert: system install_type: omnibus initial_attributes: apache: prefork: maxclients: 100 keepalive: off run_list: - recipe[apache2] - role[db] encrypted_data_bag_secret: /etc/chef/encrypted_data_bag_secret environment: _default log_level: :auto omnibus_url_retries: 2 server_url: https://chef.yourorg.com:4000 ssl_verify_mode: :verify_peer validation_name: yourorg-validator�chef)�id�name�title�description�distrosZexamples� frequencyZactivate_by_schema_keysc C s. t j| ddd�}|r*tjjt�r*tjt� d S )NZdelete_validation_post_execF)�default)r �get_cfg_option_bool�os�path�isfile�CHEF_VALIDATION_PEM_PATH�unlink)�chef_cfgZ delete_pem� r. �/usr/lib/python3.6/cc_chef.py� post_run_chef� s r0 c C s� t j� }xf|j� D ]Z\}}|tkr0tjd|� q|d krBd ||<