oB]c@sKdZddlZddlmZmZdefdYZdZdS(s Salt Minion ----------- **Summary:** set up and run salt minion 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``. **Internal name:** ``cc_salt_minion`` **Module frequency:** per instance **Supported distros:** all **Config keys**:: salt_minion: pkg_name: 'salt-minion' service_name: 'salt-minion' config_dir: '/etc/salt' conf: master: salt.example.com grains: role: - web public_key: | ------BEGIN PUBLIC KEY------- ------END PUBLIC KEY------- private_key: | ------BEGIN PRIVATE KEY------ ------END PRIVATE KEY------- iN(tsafeyamltutilt SaltConstantscBseZdZdZRS(s> defines default distribution specific salt variables cCstjr*d|_d|_d|_nd|_d|_d|_tj|d|j|_tj|d|j|_tj|d|j|_dS( Ns py36-saltt salt_minions/usr/local/etc/salts salt-minions /etc/salttpkg_namet config_dirt service_name(Rt is_FreeBSDRtsrv_nametconf_dirtget_cfg_option_str(tselftcfg((sC/usr/lib/python2.7/site-packages/cloudinit/config/cc_salt_minion.pyt__init__:s          (t__name__t __module__t__doc__R (((sC/usr/lib/python2.7/site-packages/cloudinit/config/cc_salt_minion.pyR6sc Cs,d|kr |jd|dS|d}td|}|jj|jtj|jd|krtj j |jd}t j |j d}tj||nd|krtj j |jd} t j |j d} tj| | nd|krd|krtj j |jd } tj j| sWtj j |jd } n|j d | } tjd dtj| tj j | d } tj j | d}tj| |dtj||dWdQXn|jjdkr |jjddntjd|jdgdtdS(NRs?Skipping module named %s, no 'salt_minion' key in configurationR tconftminiontgrainst public_keyt private_keys pki/miniontpkitpki_diri?s minion.pubs minion.pemtfreebsdtsalt_minion_enabletYEStservicetrestarttcapture(tdebugRtdistrotinstall_packagesRRt ensure_dirR tostpathtjoinRtdumpstgett write_filetisdirtumasktosfamilyt updatercconftsubpRtFalse(tnameR tcloudtlogt_argsts_cfgtconstt minion_configt minion_datat grains_configt grains_datatpki_dir_defaultRtpub_nametpem_name((sC/usr/lib/python2.7/site-packages/cloudinit/config/cc_salt_minion.pythandlePs<      (RR"t cloudinitRRtobjectRR;(((sC/usr/lib/python2.7/site-packages/cloudinit/config/cc_salt_minion.pyt,s