Your IP : 216.73.217.13


Current Path : /usr/lib/python3/dist-packages/cloudinit/config/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/cloudinit/config/__pycache__/cc_mcollective.cpython-38.pyc

U

�Ad��	@sUdZddlZddlZddlmZddlmZddlmZddl	m
Zddl	mZmZddl
mZdd	lmZdd
lmZmZddlmZdZd
ZdZe�e�ZdZdgZdddeeed�gedgd�Zeed<ee�Zeeefdd�Z e!eeee"dd�dd�Z#dS)z6 Mcollective: Install, configure and start mcollective�N)�Logger)�dedent)�	ConfigObj)�log)�subp�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�PER_INSTANCEz&/etc/mcollective/ssl/server-public.pemz'/etc/mcollective/ssl/server-private.pemz/etc/mcollective/server.cfga�This module installs, configures and starts mcollective. If the ``mcollective``
key is present in config, then mcollective will be installed and started.

Configuration for ``mcollective`` can be specified in the ``conf`` key under
``mcollective``. Each config value consists of a key value pair and will be
written to ``/etc/mcollective/server.cfg``. The ``public-cert`` and
``private-cert`` keys, if present in conf may be used to specify the public and
private certificates for mcollective. Their values will be written to
``/etc/mcollective/ssl/server-public.pem`` and
``/etc/mcollective/ssl/server-private.pem``.

.. note::
    The ec2 metadata service is readable by non-root users.
    If security is a concern, use include-once and ssl urls.
�allZcc_mcollectiveZMcollectivez(Install, configure and start mcollectivea�            # Provide server private and public key and provide the following
            # config settings in /etc/mcollective/server.cfg:
            # loglevel: debug
            # plugin.stomp.host: dbhost

            # WARNING WARNING WARNING
            # The ec2 metadata service is a network service, and thus is
            # readable by non-root users on the system
            # (ie: 'ec2metadata --user-data')
            # If you want security for this, please use include-once + SSL urls
            mcollective:
              conf:
                loglevel: debug
                plugin.stomp.host: dbhost
                public-cert: |
                    -------BEGIN CERTIFICATE--------
                    <cert data>
                    -------END CERTIFICATE--------
                private-cert: |
                    -------BEGIN CERTIFICATE--------
                    <cert data>
                    -------END CERTIFICATE--------
            �mcollective)�id�name�titleZdescription�distrosZexamplesZ	frequencyZactivate_by_schema_keys�metac
Cs�z"tj|ddd�}tt�|��}WnDtk
rf}z&|jtjkrD�nt�	d|�t�}W5d}~XYnX|�
�D]�\}}|dkr�tj||dd�||d<d|d	<qp|d
kr�tj||dd�||d<d|d	<qpt|t
�r�|||<qpt|t��r ||jkr�i||<|�
�D]\}	}
|
|||	<�qqpt
|�||<qpzt�|d
|�Wn6tk
�rx}z|jtjk�rfn�W5d}~XYnXt��}|�|�tj||��dd�dS)NF)�quiet�decodez4Did not find file %s (starting with an empty config)zpublic-certi�)�modezplugin.ssl_server_publicZsslZsecurityproviderzprivate-certi�zplugin.ssl_server_privatez%s.old)rZ	load_filer�io�BytesIO�IOError�errnoZENOENT�LOG�debug�itemsZ
write_file�
isinstance�str�dictZsections�copy�write�getvalue)�configZ
server_cfgZpubcert_fileZpricert_fileZold_contentsZmcollective_config�eZcfg_name�cfg�o�v�contents�r*�A/usr/lib/python3/dist-packages/cloudinit/config/cc_mcollective.py�	configure^sJ�





r,)rr&�cloudr�args�returncCsZd|kr|�d|�dS|d}|j�d�d|krBt|dd�tjdddgdd	�dS)
Nrz?Skipping module named %s, no 'mcollective' key in configuration)r�conf)r$�serviceZrestartF)Zcapture)rZdistroZinstall_packagesr,r)rr&r-rr.Zmcollective_cfgr*r*r+�handle�s�r2)$�__doc__rrZloggingr�textwraprZ	configobjrZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configr	Zcloudinit.config.schemar
rZcloudinit.settingsrZPUBCERT_FILEZPRICERT_FILEZ
SERVER_CFGZ	getLogger�__name__rZMODULE_DESCRIPTIONrr�__annotations__r,r�listr2r*r*r*r+�<module>
sR
���&�
>�