404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.135.192.192: ~ $
3

\�me7�
@s
UdZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZm
Z
mZddlmZddlmZddlmZmZdd	lmZdd
lmZdZedd
ddddg�Zedg�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�Zd;d<�Z4d=d>�Z5e6eee7dd?�d@dA�Z8dBdC�Z9ee7dD�dEdF�Z:dRedG�dHdI�Z;edJ�dKdL�Z<ee6dM�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_secretrrrrrrrr�
server_url�	node_name�environment�validation_nameZchef_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_keyscCs.tj|ddd�}|r*tjjt�r*tjt�dS)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r0cCs�tj�}xf|j�D]Z\}}|tkr0tjd|�q|dkrBd||<q|tkr\tj||�||<qtj	||�||<qW|j
tj�tj	|d|d�tj	|ddd�|d|dd��|S)	Nz'Skipping unknown chef template key '%s'r)r&rrrr)Zgenerated_byrrrr)�CHEF_RB_TPL_DEFAULTS�copy�items�CHEF_RB_TPL_KEYS�LOG�debug�CHEF_RB_TPL_BOOL_KEYSrr'�get_cfg_option_str�updateZmake_header)�iidr-�params�k�vr.r.r/�get_template_params�s&


r>)r!�cfg�cloud�args�returncCsd|krtjd|�dS|d}tj|d�}|s8tt�}xtj|t�D]}tj	|�qFW|j
dt�}|j
d�}|r�|dkr�tj||�nt
jj|�s�tjd|�|jd	�}	|	�rt|jj��}
t|
|�}t�}x2|j�D]&\}
}|
tko�|r�|jt
jj|��q�Wtj|�tj|	t|�ntjd
t�tj|dt d�}|�sJtj!d
�nbi}d|k�rd|d|d<d|k�r�|d}x"t|j"��D]}
||
||
<�q�Wtj|t#j$|��tj%|ddd�}t&j't(�}|�s�|�r�t)||�}n|�r�tj%|ddd�}nd}|�rt*|�t+|�dS)z'Handler method activated by cloud-init.rz8Skipping module named %s, no 'chef' key in configurationNZdirectoriesrr�systemzWchef validation_cert provided as 'system', but validation_key path '%s' does not exist.zchef_client.rbz&No template found, not rendering to %sZfirstboot_path)r&z7First boot path empty, not writing first boot json fileZrun_list�initial_attributes�
force_installF�exec),r5r6rZget_cfg_option_list�list�	CHEF_DIRS�	itertools�chain�REQUIRED_CHEF_DIRSZ
ensure_dir�getr+�
write_filer(r)r*�warningZget_template_filename�strZ
datasourceZget_instance_idr>�setr3�CHEF_RB_TPL_PATH_KEYS�add�dirnameZensure_dirsrZrender_to_file�CHEF_RB_PATHr8�CHEF_FB_PATH�info�keys�json�dumpsr'rZis_exe�CHEF_EXEC_PATH�install_chef�run_chefr0)r!r?r@rAr-Z	chef_dirs�dZ	vkey_pathZvcertZtemplate_fnr:r;Zparam_pathsr<r=Zfb_filenameZinitial_jsonrDrEZ	installed�runr.r.r/�handle�sj






r_cCs�tjd�tg}d|krl|d}t|ttf�r:|j|�qvt|t�rP|j|�qvtj	dt
|��|jt�n
|jt�tj|dd�dS)NzRunning chef-clientZexec_argumentszRUnknown type %s provided for chef 'exec_arguments' expected list, tuple, or stringF)�capture)
r5r6rZ�
isinstancerG�tuple�extendrO�appendrN�type�CHEF_EXEC_DEF_ARGSr)r-�cmdZcmd_argsr.r.r/r\s



r\)�distrorAcKsp|j�}|jdd�}tj|j�dd��@}tjj||�}|jd|�t	j
||dd�tjfd|i|��SQRXd	S)
aWrite blob to a tempfile, and call subp with args, kwargs. Then cleanup.

    'basename' as a kwarg allows providing the basename for the file.
    The 'args' argument to subp will be updated with the full path to the
    filename as the first argument.
    �basenameZ	subp_blobT)�dirZ	needs_exeri�)�moderAN)r2�poprZtempdirZget_tmp_exec_pathr(r)�join�insertrrMr)�blobrhrA�kwargsriZtmpdZtmpfr.r.r/�subp_blob_in_tempfile+srq)rhcCsP|dkrt}|dkrt}|dkr&g}nd|g}tj||d�j}t|||ddd�S)agInstall an omnibus unified package from url.

    @param url: URL where blob of chef content may be downloaded. Defaults to
        OMNIBUS_URL.
    @param retries: Number of retries to perform when attempting to read url.
        Defaults to OMNIBUS_URL_RETRIES
    @param omnibus_version: Optional version string to require for omnibus
        install.
    Nz-v)�url�retrieszchef-omnibus-installF)rhrorArir`)�OMNIBUS_URL�OMNIBUS_URL_RETRIESrZreadurl�contentsrq)rhrrrs�omnibus_versionrAZcontentr.r.r/�install_chef_from_omnibus>srx)r@cCs�tj|dd�}tj|ddd�}|dkrbtj|dd�}tj|dt�}t|||j�tj|dd	d�}n`|dkrz|jjd
g�nH|dkr�tj|d�}t|jtj|d
�tj|d�|d�nt	j
d|�d}|S)N�install_typeZpackagesrFF)r&Zgems�version�ruby_versionTrZomnibusrwZomnibus_urlZomnibus_url_retries)rhrrrsrwzUnknown chef install type '%s')rr8r'�RUBY_VERSION_DEFAULT�install_chef_from_gemsrh�install_packagesrxZget_cfg_option_intr5rN)r@r-ryr^�chef_versionr{rwr.r.r/r[]s*




r[)rBcCs&d|d|g}|dkr"|jd�|S)Nzruby%sz
ruby%s-devz1.8�libopenssl-ruby1.8�rubygems1.8)r�r�)rc)rzZpkgsr.r.r/�get_ruby_packages~s
r�c
Cs�|jt|��tjjd�s*tjd|d�tjjd�sFtjd|d�|rptjdddd|dd	d
ddg	d
d�ntjddddd	d
ddgd
d�dS)Nz/usr/bin/gemz/usr/bin/gem%sz
/usr/bin/rubyz/usr/bin/ruby%sZinstallrz-v %sz--no-riz	--no-rdocz--bindirz/usr/binz-qF)r`)r~r�r(r)�existsrZsym_linkr)r{rrhr.r.r/r}�s6
r})NNN)?�__doc__rIrXZloggingr(�textwraprZtypingrZ	cloudinitrrrrrZcloudinit.cloudr	Zcloudinit.configr
Zcloudinit.config.schemarrZcloudinit.distrosr
Zcloudinit.settingsrr|rbrHrKrtrur+ZCHEF_ENCRYPTED_DATA_BAG_PATHZCHEF_ENVIRONMENTrUr1�	frozensetr7rQrJrWr4rTrZrfr%r$Z	getLogger�__name__r5�metar0r>rOrGr_r\rqrxr[r�r}r.r.r.r/�<module>	s�


	#R!

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 128 B 0644
__init__.cpython-36.pyc File 128 B 0644
cc_ansible.cpython-36.opt-1.pyc File 8.63 KB 0644
cc_ansible.cpython-36.pyc File 8.63 KB 0644
cc_apk_configure.cpython-36.opt-1.pyc File 4.51 KB 0644
cc_apk_configure.cpython-36.pyc File 4.51 KB 0644
cc_apt_configure.cpython-36.opt-1.pyc File 30.42 KB 0644
cc_apt_configure.cpython-36.pyc File 30.42 KB 0644
cc_apt_pipelining.cpython-36.opt-1.pyc File 2.44 KB 0644
cc_apt_pipelining.cpython-36.pyc File 2.44 KB 0644
cc_bootcmd.cpython-36.opt-1.pyc File 2.51 KB 0644
cc_bootcmd.cpython-36.pyc File 2.51 KB 0644
cc_byobu.cpython-36.opt-1.pyc File 3.04 KB 0644
cc_byobu.cpython-36.pyc File 3.04 KB 0644
cc_ca_certs.cpython-36.opt-1.pyc File 7.05 KB 0644
cc_ca_certs.cpython-36.pyc File 7.05 KB 0644
cc_chef.cpython-36.opt-1.pyc File 9.13 KB 0644
cc_chef.cpython-36.pyc File 9.13 KB 0644
cc_disable_ec2_metadata.cpython-36.opt-1.pyc File 1.72 KB 0644
cc_disable_ec2_metadata.cpython-36.pyc File 1.72 KB 0644
cc_disk_setup.cpython-36.opt-1.pyc File 23.1 KB 0644
cc_disk_setup.cpython-36.pyc File 23.1 KB 0644
cc_fan.cpython-36.opt-1.pyc File 2.74 KB 0644
cc_fan.cpython-36.pyc File 2.74 KB 0644
cc_final_message.cpython-36.opt-1.pyc File 3.07 KB 0644
cc_final_message.cpython-36.pyc File 3.07 KB 0644
cc_growpart.cpython-36.opt-1.pyc File 15.91 KB 0644
cc_growpart.cpython-36.pyc File 15.91 KB 0644
cc_grub_dpkg.cpython-36.opt-1.pyc File 4.92 KB 0644
cc_grub_dpkg.cpython-36.pyc File 4.92 KB 0644
cc_install_hotplug.cpython-36.opt-1.pyc File 3.25 KB 0644
cc_install_hotplug.cpython-36.pyc File 3.25 KB 0644
cc_keyboard.cpython-36.opt-1.pyc File 1.98 KB 0644
cc_keyboard.cpython-36.pyc File 1.98 KB 0644
cc_keys_to_console.cpython-36.opt-1.pyc File 3.11 KB 0644
cc_keys_to_console.cpython-36.pyc File 3.11 KB 0644
cc_landscape.cpython-36.opt-1.pyc File 4.71 KB 0644
cc_landscape.cpython-36.pyc File 4.71 KB 0644
cc_locale.cpython-36.opt-1.pyc File 1.58 KB 0644
cc_locale.cpython-36.pyc File 1.58 KB 0644
cc_lxd.cpython-36.opt-1.pyc File 13.04 KB 0644
cc_lxd.cpython-36.pyc File 13.04 KB 0644
cc_mcollective.cpython-36.opt-1.pyc File 4.24 KB 0644
cc_mcollective.cpython-36.pyc File 4.24 KB 0644
cc_migrator.cpython-36.opt-1.pyc File 2.92 KB 0644
cc_migrator.cpython-36.pyc File 2.92 KB 0644
cc_mounts.cpython-36.opt-1.pyc File 14.08 KB 0644
cc_mounts.cpython-36.pyc File 14.08 KB 0644
cc_ntp.cpython-36.opt-1.pyc File 13.15 KB 0644
cc_ntp.cpython-36.pyc File 13.15 KB 0644
cc_package_update_upgrade_install.cpython-36.opt-1.pyc File 3.78 KB 0644
cc_package_update_upgrade_install.cpython-36.pyc File 3.78 KB 0644
cc_phone_home.cpython-36.opt-1.pyc File 4.1 KB 0644
cc_phone_home.cpython-36.pyc File 4.1 KB 0644
cc_power_state_change.cpython-36.opt-1.pyc File 6.24 KB 0644
cc_power_state_change.cpython-36.pyc File 6.24 KB 0644
cc_puppet.cpython-36.opt-1.pyc File 9.46 KB 0644
cc_puppet.cpython-36.pyc File 9.46 KB 0644
cc_reset_rmc.cpython-36.opt-1.pyc File 3.59 KB 0644
cc_reset_rmc.cpython-36.pyc File 3.59 KB 0644
cc_resizefs.cpython-36.opt-1.pyc File 7.02 KB 0644
cc_resizefs.cpython-36.pyc File 7.02 KB 0644
cc_resolv_conf.cpython-36.opt-1.pyc File 4.27 KB 0644
cc_resolv_conf.cpython-36.pyc File 4.27 KB 0644
cc_rh_subscription.cpython-36.opt-1.pyc File 12.06 KB 0644
cc_rh_subscription.cpython-36.pyc File 12.06 KB 0644
cc_rightscale_userdata.cpython-36.opt-1.pyc File 2.77 KB 0644
cc_rightscale_userdata.cpython-36.pyc File 2.77 KB 0644
cc_rsyslog.cpython-36.opt-1.pyc File 10.34 KB 0644
cc_rsyslog.cpython-36.pyc File 10.34 KB 0644
cc_runcmd.cpython-36.opt-1.pyc File 2.43 KB 0644
cc_runcmd.cpython-36.pyc File 2.43 KB 0644
cc_salt_minion.cpython-36.opt-1.pyc File 4.36 KB 0644
cc_salt_minion.cpython-36.pyc File 4.36 KB 0644
cc_scripts_per_boot.cpython-36.opt-1.pyc File 1.4 KB 0644
cc_scripts_per_boot.cpython-36.pyc File 1.4 KB 0644
cc_scripts_per_instance.cpython-36.opt-1.pyc File 1.57 KB 0644
cc_scripts_per_instance.cpython-36.pyc File 1.57 KB 0644
cc_scripts_per_once.cpython-36.opt-1.pyc File 1.51 KB 0644
cc_scripts_per_once.cpython-36.pyc File 1.51 KB 0644
cc_scripts_user.cpython-36.opt-1.pyc File 1.58 KB 0644
cc_scripts_user.cpython-36.pyc File 1.58 KB 0644
cc_scripts_vendor.cpython-36.opt-1.pyc File 2.04 KB 0644
cc_scripts_vendor.cpython-36.pyc File 2.04 KB 0644
cc_seed_random.cpython-36.opt-1.pyc File 4.07 KB 0644
cc_seed_random.cpython-36.pyc File 4.07 KB 0644
cc_set_hostname.cpython-36.opt-1.pyc File 4 KB 0644
cc_set_hostname.cpython-36.pyc File 4 KB 0644
cc_set_passwords.cpython-36.opt-1.pyc File 8.4 KB 0644
cc_set_passwords.cpython-36.pyc File 8.4 KB 0644
cc_snap.cpython-36.opt-1.pyc File 5.94 KB 0644
cc_snap.cpython-36.pyc File 5.94 KB 0644
cc_spacewalk.cpython-36.opt-1.pyc File 2.87 KB 0644
cc_spacewalk.cpython-36.pyc File 2.87 KB 0644
cc_ssh.cpython-36.opt-1.pyc File 11.02 KB 0644
cc_ssh.cpython-36.pyc File 11.02 KB 0644
cc_ssh_authkey_fingerprints.cpython-36.opt-1.pyc File 3.54 KB 0644
cc_ssh_authkey_fingerprints.cpython-36.pyc File 3.54 KB 0644
cc_ssh_import_id.cpython-36.opt-1.pyc File 3.85 KB 0644
cc_ssh_import_id.cpython-36.pyc File 3.85 KB 0644
cc_timezone.cpython-36.opt-1.pyc File 1.24 KB 0644
cc_timezone.cpython-36.pyc File 1.24 KB 0644
cc_ubuntu_advantage.cpython-36.opt-1.pyc File 12.42 KB 0644
cc_ubuntu_advantage.cpython-36.pyc File 12.42 KB 0644
cc_ubuntu_autoinstall.cpython-36.opt-1.pyc File 3.89 KB 0644
cc_ubuntu_autoinstall.cpython-36.pyc File 3.89 KB 0644
cc_ubuntu_drivers.cpython-36.opt-1.pyc File 3.63 KB 0644
cc_ubuntu_drivers.cpython-36.pyc File 3.63 KB 0644
cc_update_etc_hosts.cpython-36.opt-1.pyc File 4.3 KB 0644
cc_update_etc_hosts.cpython-36.pyc File 4.3 KB 0644
cc_update_hostname.cpython-36.opt-1.pyc File 3.01 KB 0644
cc_update_hostname.cpython-36.pyc File 3.01 KB 0644
cc_users_groups.cpython-36.opt-1.pyc File 7.58 KB 0644
cc_users_groups.cpython-36.pyc File 7.58 KB 0644
cc_wireguard.cpython-36.opt-1.pyc File 8.39 KB 0644
cc_wireguard.cpython-36.pyc File 8.39 KB 0644
cc_write_files.cpython-36.opt-1.pyc File 5.61 KB 0644
cc_write_files.cpython-36.pyc File 5.61 KB 0644
cc_write_files_deferred.cpython-36.opt-1.pyc File 1.73 KB 0644
cc_write_files_deferred.cpython-36.pyc File 1.73 KB 0644
cc_yum_add_repo.cpython-36.opt-1.pyc File 6.03 KB 0644
cc_yum_add_repo.cpython-36.pyc File 6.03 KB 0644
cc_zypper_add_repo.cpython-36.opt-1.pyc File 5.66 KB 0644
cc_zypper_add_repo.cpython-36.pyc File 5.66 KB 0644
modules.cpython-36.opt-1.pyc File 7.31 KB 0644
modules.cpython-36.pyc File 7.31 KB 0644
schema.cpython-36.opt-1.pyc File 39.45 KB 0644
schema.cpython-36.pyc File 39.45 KB 0644