%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/roster/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/roster/cloud.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	Zddl
ZddlZddlm
Z
dd�Zd�ZdS(u�
Use the cloud cache on the master to derive IPv4 addresses based on minion ID.

This roster requires that the minion in question was created using at least the
2015.5.0 version of Salt Cloud. Starting with the 2015.5.0 release, Salt Cloud
maintains an index of minions that it creates and deletes. This index tracks the
provider and profile configuration used to provision the minion, including
authentication information. So long as this configuration remains current, it can
be used by Salt SSH to log into any minion in the index.

To connect as a user other than root, modify the cloud configuration file
usually located at /etc/salt/cloud. For example, add the following:

.. code-block:: yaml

    ssh_username: my_user
    sudo: True
i(tabsolute_importtprint_functiontunicode_literalsN(tstring_typesuglobc	K@s�i}tjjtjjtjjtd�d��}td|�}xG|j	�D]9\}}|j
dd�|j
dd�}}	i|	d6|d6}
|j
dg�}|j
dg�}g}
xO||fD]A}t|t
�r�|
|}
q�t|t�r�|
j|�q�q�Wtj
d	d�}t||
�}tjtj
d
i��||<||ji|d6�tjjj|
|�}t|t�r�|||d<n7t|t
�r�|ddkr�|d||d<q�ntjjd|
|dtdd�}|r|||d<ntjjd|
|dtdd�}|rR|||d<ntjjd|
|dtdd�}|rT|||d<qTqTW|S(us
    Return the targets from the flat yaml file, checks opts for location but
    defaults to /etc/salt/roster
    u	conf_fileuclouducache.clouduprofileuproviderudriveru
public_ipsuprivate_ipsuroster_orderupublicuprivateulocaluroster_defaultsuhostuuseriurootussh_passwordt
search_globaltdefaultupassworduprivate_keyuprivusudoN(upublicuprivateulocal(tsalttconfigtcloud_configtostpathtjointdirnamet__opts__t
__runner__titemstgettNonet
isinstancetlistRtappendtextract_ipv4tcopytdeepcopytupdatetutilstcloudt
ssh_usernamestget_cloud_config_valuetFalse(ttgtttgt_typetkwargstrett
cloud_optstminionst	minion_idt	full_infotprofiletprovidertvm_t
public_ipstprivate_ipstip_listtitemtroster_ordertpreferred_iptssh_usernametpasswordtkey_filenametsudo((s5/usr/lib/python2.7/site-packages/salt/roster/cloud.pyttargets"sR	(%

					cC@s�x�|D]�}x�|D]�}d|kr,qntjjjj|�sJqn|dkri|jd�ri|S|dkr�tjjj|�r�|S|dkrtjjj|�r|SqWqWdS(u>
    Extract the preferred IP address from the ipv4 grain
    u:ulocalu127.uprivateupublicN(	RRtvalidatetnett	ipv4_addrt
startswithRtis_public_ipR(R-tipv4tip_typetip_((s5/usr/lib/python2.7/site-packages/salt/roster/cloud.pyRas

"!(t__doc__t
__future__RRRR	Rtsalt.loaderRtsalt.utils.cloudtsalt.utils.validate.nettsalt.configtsalt.ext.sixRR3R(((s5/usr/lib/python2.7/site-packages/salt/roster/cloud.pyt<module>s?

Zerion Mini Shell 1.0