HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_salt_minion.cpython-36.pyc
3

\�me��	@s�UdZddlZddlZddlmZddlmZmZmZddl	m
Z
ddlmZddl
mZmZddlmZdd	lmZd
Zddd
eegeed�gdgd�Zeee�Zeje�ZGdd�d�Zeee
edd�dd�ZdS)z&Salt Minion: Setup and run salt minion�N)�dedent)�safeyaml�subp�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�ALL_DISTROS)�PER_INSTANCEa.This module installs, configures and starts salt minion. If the ``salt_minion``
key is present in the config parts, then salt minion will be installed and
started. Configuration for salt minion can be specified in the ``conf`` key
under ``salt_minion``. Any conf values present there will be assigned in
``/etc/salt/minion``. The public and private keys to use for salt minion can be
specified with ``public_key`` and ``private_key`` respectively. Optionally if
you have a custom package name, service name or config directory you can
specify them with ``pkg_name``, ``service_name`` and ``config_dir``.

Salt keys can be manually generated by: ``salt-key --gen-keys=GEN_KEYS``,
where ``GEN_KEYS`` is the name of the keypair, e.g. 'minion'.  The keypair
will be copied to ``/etc/salt/pki`` on the minion instance.
Zcc_salt_minionzSalt MinionzSetup and run salt minionai            salt_minion:
                pkg_name: salt-minion
                service_name: salt-minion
                config_dir: /etc/salt
                conf:
                    file_client: local
                    fileserver_backend:
                      - gitfs
                    gitfs_remotes:
                      - https://github.com/_user_/_repo_.git
                    master: salt.example.com
                grains:
                    role:
                        - web
                public_key: |
                    ------BEGIN PUBLIC KEY-------
                    <key data>
                    ------END PUBLIC KEY-------
                private_key: |
                    ------BEGIN PRIVATE KEY------
                    <key data>
                    ------END PRIVATE KEY-------
                pki_dir: /etc/salt/pki/minion
            �salt_minion)�id�name�title�descriptionZdistrosZ	frequencyZexamplesZactivate_by_schema_keysc@seZdZdZdd�ZdS)�
SaltConstantsz>
    defines default distribution specific salt variables
    cCshtj�rd|_d|_d|_nd|_d|_d|_tj|d|j�|_tj|d|j�|_tj|d|j�|_dS)	Nzpy-saltrz/usr/local/etc/saltzsalt-minionz	/etc/salt�pkg_nameZ
config_dirZservice_name)rZ
is_FreeBSDr�srv_name�conf_dirZget_cfg_option_str)�self�cfg�r�$/usr/lib/python3.6/cc_salt_minion.py�__init__TszSaltConstants.__init__N)�__name__�
__module__�__qualname__�__doc__rrrrrrOsr)rr�cloud�args�returncCs�d|krtjd|�dS|d}t|d�}|jj|jg�tj|j�d}d|kr~t	j
j|jd�}|jd�}tj
|tj|��d|kr�t	j
j|jd�}tj|jd��}	tj
||	�d|ko�d|k�rXt	j
j|jd	�}
t	j
j|
�s�t	j
j|jd
�}
|jd|
�}tjd��Ltj|�t	j
j|d
�}t	j
j|d�}
tj
||d�tj
|
|d�WdQRXt|�ol|jd�dk�}|jj|�r�dnd|j�|jj|�r�dnd|j�|�s�tjdddgdd�dS)Nrz?Skipping module named %s, no 'salt_minion' key in configuration)rZconfZminionZgrainsZ
public_keyZprivate_keyz
pki/minionZpki�pki_dir�?z
minion.pubz
minion.pemZfile_clientZlocal�enable�disableZrestart�stopz	salt-callz--localzstate.applyF)Zcapture)�LOG�debugrZdistroZinstall_packagesrrZ
ensure_dirr�os�path�join�getZ
write_filer�dumps�isdir�umask�boolZmanage_servicerr)rrrrZs_cfg�constZminion_dataZ
minion_configZ
grains_configZgrains_dataZpki_dir_defaultr!Zpub_nameZpem_nameZ
minion_daemonrrr�handlejsJ


r1)rZloggingr(�textwraprZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarr	Zcloudinit.distrosr
Zcloudinit.settingsrZMODULE_DESCRIPTION�metaZ	getLoggerrr&r�str�listr1rrrr�<module>s.