HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1991111/cwd/lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //proc/1991111/cwd/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_puppet.cpython-311.pyc
�

܍~c�4��t�UdZddlZddlZddlmZddlmZddlmZddl	Z	ddl
mZmZm
Z
mZmZddlmZddlmZdd	lmZmZdd
lmZmZddlmZdZd
gZdZdddeegeed��ed��gdgd�Zee d<ee��ZGd�d��Z!d�Z"d�Z#edddfdefd�Z$de%ded ed!ed"e&d#dfd$�Z'dS)%z+Puppet: Install, configure and start puppet�N)�StringIO)�Logger)�dedent)�helpers�subp�
temp_utils�
url_helper�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�ALL_DISTROS�Distro)�PER_INSTANCEzKhttps://raw.githubusercontent.com/puppetlabs/install-puppet/main/install.shz--testa>This module handles puppet installation and configuration. If the ``puppet``
key does not exist in global configuration, no action will be taken. If a
config entry for ``puppet`` is present, then by default the latest version of
puppet will be installed. If the ``puppet`` config key exists in the config
archive, this module will attempt to start puppet even if no installation was
performed.

The module also provides keys for configuring the new puppet 4 paths and
installing the puppet package from the puppetlabs repositories:
https://docs.puppet.com/puppet/4.2/reference/whered_it_go.html
The keys are ``package_name``, ``conf_file``, ``ssl_dir`` and
``csr_attributes_path``. If unset, their values will default to
ones that work with puppet 3.x and with distributions that ship modified
puppet 4.x that uses the old paths.
�	cc_puppet�Puppetz#Install, configure and start puppeta`            puppet:
                install: true
                version: "7.7.0"
                install_type: "aio"
                collection: "puppet7"
                aio_install_url: 'https://git.io/JBhoQ'
                cleanup: true
                conf_file: "/etc/puppet/puppet.conf"
                ssl_dir: "/var/lib/puppet/ssl"
                csr_attributes_path: "/etc/puppet/csr_attributes.yaml"
                exec: true
                exec_args: ['--test']
                conf:
                    agent:
                        server: "puppetserver.example.org"
                        certname: "%i.%f"
                    ca_cert: |
                        -----BEGIN CERTIFICATE-----
                        MIICCTCCAXKgAwIBAgIBATANBgkqhkiG9w0BAQUFADANMQswCQYDVQQDDAJjYTAe
                        Fw0xMDAyMTUxNzI5MjFaFw0xNTAyMTQxNzI5MjFaMA0xCzAJBgNVBAMMAmNhMIGf
                        MA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCu7Q40sm47/E1Pf+r8AYb/V/FWGPgc
                        b014OmNoX7dgCxTDvps/h8Vw555PdAFsW5+QhsGr31IJNI3kSYprFQcYf7A8tNWu
                        1MASW2CfaEiOEi9F1R3R4Qlz4ix+iNoHiUDTjazw/tZwEdxaQXQVLwgTGRwVa+aA
                        qbutJKi93MILLwIDAQABo3kwdzA4BglghkgBhvhCAQ0EKxYpUHVwcGV0IFJ1Ynkv
                        T3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwDwYDVR0TAQH/BAUwAwEB/zAd
                        BgNVHQ4EFgQUu4+jHB+GYE5Vxo+ol1OAhevspjAwCwYDVR0PBAQDAgEGMA0GCSqG
                        SIb3DQEBBQUAA4GBAH/rxlUIjwNb3n7TXJcDJ6MMHUlwjr03BDJXKb34Ulndkpaf
                        +GAlzPXWa7bO908M9I8RnPfvtKnteLbvgTK+h+zX1XCty+S2EQWk29i2AdoqOTxb
                        hppiGMp0tT5Havu4aceCXiy2crVcudj3NFciy8X66SoECemW9UYDCb9T5D0d
                        -----END CERTIFICATE-----
                csr_attributes:
                    custom_attributes:
                        1.2.840.113549.1.9.7: 342thbjkt82094y0uthhor289jnqthpc2290
                    extension_requests:
                        pp_uuid: ED803750-E3C7-44F5-BB08-41A04433FE2E
                        pp_image_name: my_ami_image
                        pp_preshared_key: 342thbjkt82094y0uthhor289jnqthpc2290
            z�            puppet:
                install_type: "packages"
                package_name: "puppet"
                exec: false
            �puppet)�id�name�title�description�distros�	frequency�examples�activate_by_schema_keys�metac��eZdZd�ZdS)�PuppetConstantsc���||_||_tj�|d��|_tj�|jd��|_||_dS)N�certszca.pem)�	conf_path�ssl_dir�os�path�join�ssl_cert_dir�
ssl_cert_path�csr_attributes_path)�self�puppet_conf_file�puppet_ssl_dirr)�logs     �</usr/lib/python3/dist-packages/cloudinit/config/cc_puppet.py�__init__zPuppetConstants.__init__osS��*���%����G�L�L���A�A����W�\�\�$�*;�X�F�F���#6�� � � �N)�__name__�
__module__�__qualname__r/�r0r.rrns#������7�7�7�7�7r0rc�p�tj�d��rtjgd�d���dStjd��rtjgd�d���dStj�d��rtjgd�d���dS|�d	��dS)
N�/etc/default/puppet)�sedz-iz-ezs/^START=.*/START=yes/r6F��capture�	systemctl)r:�enablezpuppet.service�/sbin/chkconfig)r<r�onzASorry we do not know how to enable puppet services on this system)r$r%�existsr�which�warning)r-s r.�_autostart_puppetrAys���	�w�~�~�+�,�,�
��	�
�
�
��		
�		
�		
�		
�		
�		
�
��K�	 �	 �
��	�;�;�;�U�K�K�K�K�K�K�	����)�	*�	*�
��	�5�5�5�u�E�E�E�E�E�E����O�	
�	
�	
�	
�	
r0c�`�tj|dd|g��\}}|���S)z�Get the config value for a given setting using `puppet config print`
    :param puppet_bin: path to puppet binary
    :param setting: setting to query
    �config�print)r�rstrip)�
puppet_bin�setting�out�_s    r.�get_config_valuerJ�s.��
�Y�
�H�g�w�?�
@�
@�F�C���:�:�<�<�r0T�distroc��g}|�d|g}|�|d|gz
}|r|dgz
}tj|d���j}tj|���d���5}tj�|d	��}tj
||d
���tj|g|zd�
��cddd��S#1swxYwYdS)a�Install puppet-agent from the puppetlabs repositories using the one-shot
    shell script

    :param distro: Instance of Distro
    :param url: URL from where to download the install script
    :param version: version to install, blank defaults to latest
    :param collection: collection to install, blank defaults to latest
    :param cleanup: whether to purge the puppetlabs repo after installation
    Nz-vz-cz	--cleanup�)�url�retriesT)�dir�	needs_exezpuppet-installi�)�modeFr8)r	�readurl�contentsr�tempdir�get_tmp_exec_pathr$r%r&r
�
write_filer)	rKrN�version�
collection�cleanup�args�content�tmpd�tmpfs	         r.�install_puppet_aior_�s-�� �D����g�������z�"�"������
���� �S�!�4�4�4�=�G�
�	��$�$�&�&�$�
�
�
�7�	
��w�|�|�D�"2�3�3�����g�E�2�2�2�2��y�$��$���6�6�6�7�7�7�7�7�7�7�7�7�7�7�7����7�7�7�7�7�7s�AB;�;B?�B?r�cfg�cloudr-r[�returnc�z�d|vr|�d|��dS|d}tj|dd��}tj|dd��}tj|dd��}tj|dd��}	tj|d	d��}
tj|d
d���}tj|d
d���}tj|dt���}
|	dkrd}d}d}nd}d}d}tj|d|��}|s|r|�d��nw|ru|�d|r|nd|	��|	dkr|j�||f��n7|	dkrt|j|
|||
��n|�d|	��d}tj|dt|d����}tj|dt|d����}tj|dt|d����}t||||��}d|v�r7tj|j��}tj��}d�|���D��}d �|��}|�t%|��|j�!��|d���D�]�\}}|d"kr�tj|jd#��tj|j|d��tj|j��tj|j|d��tj|j|��tj|j|d��n�|���D]�\}}|d$krc|�d%t7j����}|�d&|�����}|���}|�|||����tj |jd'|jz��tj|j|�!�������d|vr4tj|j"tGj$|dd�(����|rtK|��|�r|�d)��|d*g}d+|vr�|d+}tM|tNtPf��r|�)|��n�tM|tT��r(|�)|�+����nX|�d,tY|����|�)tZ��n|�)tZ��t]j.|d�-��|rt]j.gd.�d�-��dSdS)/Nrz9Skipping module named %s, no 'puppet' configuration found�installTrXrY�install_type�packagesrZ�execF)�default�
start_service�aio_install_url�aio�rootz/opt/puppetlabs/bin/puppetzpuppet-agent�package_namez@Puppet install set to false but version supplied, doing nothing.z'Attempting to install puppet %s from %s�latestz Unknown puppet install type '%s'�	conf_filerCr#�ssldirr)�csr_attributes�confc�6�g|]}|�����Sr4)�lstrip)�.0�is  r.�
<listcomp>zhandle.<locals>.<listcomp>s ��C�C�C�������C�C�Cr0�
)�source�ca_certi��certnamez%fz%iz%s.old)�default_flow_stylezRunning puppet-agent�agent�	exec_argszOUnknown type %s provided for puppet 'exec_args' expected list, tuple, or stringr8)�servicer�start)/�debugr
�get_cfg_option_bool�get_cfg_option_str�AIO_INSTALL_URLr@rK�install_packagesr_rJr�	load_filer"r�DefaultingConfigParser�
splitlinesr&�	read_filer�items�
ensure_dirr#�chownbynamer'rWr(�replace�socket�getfqdn�get_instance_id�lower�set�rename�	stringifyr)�yaml�dumprA�
isinstance�list�tuple�extend�str�split�type�PUPPET_AGENT_DEFAULT_ARGSr)rr`rar-r[�
puppet_cfgrdrXrYrerZ�run�
start_puppetdrj�puppet_userrF�puppet_packagermror#r)�p_constantsrT�
puppet_config�
cleaned_lines�cleaned_contents�cfg_name�o�v�cmd�cmd_argss                               r.�handler��sX���s����	�	�G��	
�	
�	
�	���X��J��&�z�9�d�C�C�G��%�j�)�T�B�B�G��(��\�4�H�H�J��*��N�J���L��&�z�9�d�C�C�G�
�
"�:�v�u�
E�
E�
E�C��,��O�T����M��-��%�����O�
�u�����1�
�'������
�!���*��N�N���L���w�����N�	
�	
�	
�	
�
���	�	�5��,�G�G�H��	
�	
�	
��:�%�%��L�)�)�<��*A�B�B�B�B�
�U�
"�
"����o�w�
�G�
�
�
�
�
�K�K�:�L�I�I�I��C��'��K�!1�*�h�!G�!G���I��%��I�/�
�H�E�E���G��1�����%5�6�6����"�)�W�6I�3�O�O�K������>�+�"7�8�8���6�8�8�
�D�C�X�-@�-@�-B�-B�C�C�C�
��9�9�]�3�3������%�&�&�{�/D�	 �	
�	
�	
� *�&�1�7�7�9�9�!	N�!	N�O�X�s��9�$�$���� 3�U�;�;�;�� ��!4�k�6�J�J�J���� 8�9�9�9�� ��!9�;��O�O�O���� 9�3�?�?�?�� ��-�{�F�����"�i�i�k�k�	6�	6�F�Q���J����I�I�d�F�N�,<�,<�=�=���I�I�d�E�,A�,A�,C�,C�D�D���G�G�I�I��!�%�%�h��1�5�5�5�5�
�K��%�x�;�3H�'I�
�
�
�
�O�K�1�=�3J�3J�3L�3L�M�M�M�M��:�%�%����+��I�j�!1�2�u�M�M�M�	
�	
�	
����#�����&��	�	�(�)�)�)��7�#���*�$�$�!�+�.�H��(�T�5�M�2�2�
6��
�
�8�$�$�$�$��H�c�*�*�	
6��
�
�8�>�>�+�+�,�,�,�,����!���N�N�	����
�
�4�5�5�5�5��J�J�0�1�1�1��	�#�u�%�%�%�%��A��	�0�0�0�%�@�@�@�@�@�@�A�Ar0)(�__doc__r$r��ior�loggingr�textwraprr��	cloudinitrrrr	r
�cloudinit.cloudr�cloudinit.configr�cloudinit.config.schemar
r�cloudinit.distrosrr�cloudinit.settingsrr�r��MODULE_DESCRIPTIONr�__annotations__rrArJr_r�r�r�r4r0r.�<module>r�sa��2�1�1�	�	�	�	�
�
�
�
�����������������������A�A�A�A�A�A�A�A�A�A�A�A�A�A�!�!�!�!�!�!�#�#�#�#�#�#�<�<�<�<�<�<�<�<�1�1�1�1�1�1�1�1�+�+�+�+�+�+�_��%�J����$��
2�%��}����&
�(	
�(	
�R	��
�	
�	
�U2�f!)�z�u;�;��j�;�;�;�z�,�t�
�
��7�7�7�7�7�7�7�7�
�
�
�.���	����!7�!7��!7�!7�!7�!7�H^A�

�^A��^A�#(�^A�/5�^A�=A�^A�	�^A�^A�^A�^A�^A�^Ar0