%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c'@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl
Z
yddlZeZWnek
r5eZnXy�ddlmZddl m!Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ej)d	�j*ej+�ej)d
�j*ej+�eZ,Wnek
r�eZ,nXy&ddl-Z-ddl.m/Z/eZ0Wnek
reZ0nXddl1Zddl2Zddl3Zddl4Zddl5Zddl6Zddl7Zddl8Zddl9Zddl:Zddl;Zddl<Zddl=Zddl>Zddl?Zddl@ZddlAmBZBdd
lCmDZDddlEZddlFmGZGmHZHmIZImJZJmKZKmLZLddlMmNZNddlOmPZPddlQmRZRyddlSZSWn*ek
r�ejTjUjV�r��nnXyddlWZWeZXWnek
r�eZXnXdZYidd6dd6dd6dd6ZZej[dej\�Z]ej[dej\�Z^ej)e_�Z`eaeadd�Zbd�Zcd�Zdd �Zeeaeadd!�Zfd"d#�Zgd$�Zhd%�Zid&�Zjd'�Zkd(�Zld)d*�Zmead+�Znead,�Zod-d.�Zpd/d-ead0�Zqd1erfd2��YZd3d4�Zsd3d5�Ztd-d6�Zud-d7�Zvd-eed8�Zwd9ead:dd;�Zxd9ead:dd<�Zyd/d=d>eaead=deead?ead@�Zzd3d-d9eaeaeaeaeaeeaeaeaeeaead=eaeaeadAeaeaedBeedC�Z{d/d-d>eaeaeaeaeaeaeaeaeeaeaeaeaeaeaeeaead=d=eeeeaeeaeeaeaeadDeaeaeaedE�&Z|ead/d-d>eaead=eeeaeeaeaeadFdG�Z}dH�Z~eadIdJ�ZeaedK�Z�eaeaeadL�Z�eaeaeadM�Z�eaeaeadN�Z�dO�Z�dP�Z�edQ�Z�eaeadRdS�Z�dT�Z�dU�Z�dV�Z�eadW�Z�eaeadXdYdXdd:dZ�Z�ead[�Z�d\d=d]�Z�d^�Z�ead_�Z�ead`�Z�eada�Z�eadeaeaeadb�Z�eaeadc�Z�eadd�Z�eade�Z�eaeaeadf�Z�eadg�Z�dh�Z�di�Z�dj�Z�dk�Z�dl�Z�dm�Z�ej�dne��do�Z�dp�Z�eadq�Z�dr�Z�eaeaeads�Z�dt�Z�du�Z�dv�Z�dS(wu"
Utility functions for salt.cloud
i(tabsolute_importtprint_functiontunicode_literalsN(tClient(tService(t
SCMRException(tTreeConnect(tSMBResponseExceptionusmbprotocolupypsexec(tWinRMTransportError(tNonBlockingPopen(tis_writeable(tSaltCloudConfigErrortSaltCloudExceptiontSaltCloudSystemExittSaltCloudExecutionTimeouttSaltCloudExecutionFailuretSaltCloudPasswordError(tsix(trange(tTemplateuutf-8urunningu	rebootingiu
terminatediupendingiu"(?:.*)[Pp]assword(?: for .*)?:\ *$u((?:.*sudo)(?:.*)[Pp]assword(?: for .*)?:ucC@s�tjd|�yktjjj|d��M}ttjjj|j	���}t
j|jd|d|d|��SWdQXWnEt
k
r�tjjj|d��}t
j|j	��SWdQXnXdS(u$
    Return the rendered script
    uRendering deploy script: %surtoptstvmtminionN(tlogtinfotsalttutilstfilestfopenRtstringutilst
to_unicodetreadRt	text_typetrendertAttributeError(tpathtvm_RRtfp_ttemplate((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt__render_script}s!/
cC@sKi}|rG|d|d<|d|d<|d|d<|d|d<n|S(u�
    Return a dictionary with gateway options. The result is used
    to provide arguments to __ssh_gateway_arguments method.
    ussh_gatewayussh_gateway_keyussh_gateway_userussh_gateway_command((tgatewaytextended_kwargs((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt__ssh_gateway_config_dict�sc	C@s�d}|jdd�}d}d|krB|jd�\}}n|jdd�}|r�|jd|�}d|kr�d	j|d�nd}|jd
d�}djd
dd|||||�}tjd||||�n|S(u
    Return ProxyCommand configuration string for ssh/scp command.

    All gateway options should not include quotes (' or "). To support
    future user configuration, please make sure to update the dictionary
    from __ssh_gateway_config_dict and get_ssh_gateway_config (ec2.py)
    uussh_gatewayiu:ussh_gateway_commandunc -q0 %h %pussh_gateway_portussh_gateway_keyu-i {0}ussh_gateway_userurootu7-oProxyCommand="ssh {0} {1} {2} {3} {4}@{5} -p {6} {7}"u-oStrictHostKeyChecking=nou-oUserKnownHostsFile=/dev/nullu-oControlPath=noneuUsing SSH gateway %s@%s:%s %s(tgettsplittformatRR(tkwargstextended_argumentstssh_gatewaytssh_gateway_porttssh_gateway_commandtssh_gateway_keytssh_gateway_user((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt__ssh_gateway_arguments�s.%	cC@stjjjd�S(u1
    True when winexe is found on the system
    uwinexe(RRR#twhich(((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
has_winexe�scC@s"|rt|�}ntjj|�r:t||||�Stjjdj|��rqtdj|�|||�Sx�|dD]�}tjjtjj||��r�ttjj||�|||�Stjjtjj|dj|���r|ttjj|dj|��|||�Sq|WdS(u;
    Return the script as a string for the specific os
    u{0}.shudeploy_scripts_search_pathu(tsalt_config_to_yamltosR#tisabsR'R-tisfiletjoin(tos_R$RRtsearch_path((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt	os_script�s!*icC@s�|dkrd}ntj�}tjj|d|�tjj|d�}tjj|d�}tjj	j
|��"}tjjj|j
��}WdQXtjj	j
|��"}tjjj|j
��}WdQXtj|�||fS(uG
    Generate Salt minion keys and return them as PEM file strings
    iuminionu
minion.pemu
minion.pubN(ttempfiletmkdtempRtcrypttgen_keysR9R#R<RRRRRRtshutiltrmtree(tkeysizettdirt	priv_pathtpub_pathR%tprivtpub((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyRC�s	!!
cC@sxEdD]=}tjj||�}tjj|�stj|�qqWtjj|d|�}tjjj|d��#}|j	tjj
j|��WdQXtjj|d|�}tjj|�r
tjjj|��)}|j
�|krtj|�nWdQXndS(u�
    If the master config was available then we will have a pki_dir key in
    the opts directory, this method places the pub key in the accepted
    keys dir and removes it from the unaccepted keys dir if that is the case.
    uminionsuminions_preuminions_rejecteduw+N(uminionsuminions_preuminions_rejected(R9R#R<texiststmakedirsRRRRtwriteRtto_strR;Rtremove(tpki_dirRKtid_tkey_dirtkey_pathtkeyR%toldkey((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
accept_keys
"cC@sNtjj|d|�}tjj|�rJtj|�tjd|�ndS(uH
    This method removes a specified key from the accepted keys dir
    uminionsuDeleted '%s'N(R9R#R<R;RPRtdebug(RQRRRU((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
remove_keys
cC@sYtjj|d|�}tjj|d|�}tjj|�rUtj||�ndS(u>
    Rename a key, when an instance has also been renamed
    uminionsN(R9R#R<R;trename(RQRRtnew_idRVtnewkey((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
rename_key sc
C@s�idd6dd6dd6}|d|d<tjjd	||�}|dk	rZ||d	<n|jtjjd
||didt��tjjd
||�}d|kr�|tk	r�td��n|jdi�jtjjd||didt��|S(uI
    Return a minion's configuration for the provided options and VM
    usaltumasteruinfou	log_levelusha256u	hash_typeunameuidu
master_fingeruminiontdefaultt
search_globalumake_masteru?A master setting was not defined in the minion's configuration.ugrainsN(Rtconfigtget_cloud_config_valuetNonetupdatetTrueRt
setdefault(RR$Rt
master_fingertmake_master((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
minion_config*s&

		c	C@s`tjtjj�}|jdddddd�|jtjjd||didt��|S(	uI
    Return a master's configuration for the provided options and VM
    t	log_leveluinfotlog_level_logfilet	hash_typeusha256umasterR^R_(tcopytdeepcopyRR`tDEFAULT_MASTER_OPTSRcRaRd(RR$tmaster((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
master_configXs		u
cC@stjjj|d|dt�S(uR
    Return a salt configuration dictionary, master or minion, as a yaml dump
    t
line_breaktdefault_flow_style(RRtyamlt	safe_dumptFalse(t
configurationRq((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR8qscC@s
|dokrt}ntjjd||dt�}tjjd||ddo�}|tkr{|dokr{iidd6d6S|jd�dkr�t}nt}tjjd	||d
tdtjjd||d
tddo��}|dok	rtj	j
|�rtdj|���nt}|jd
t�rjdtj
krjtjtjtj
d�j�rjt}n|dokr�tjjd||ddo�dokr�tjjd||ddo�dokr�|tkr�td��ni}t||�}ttjjd||dd�|||�}	tjjd||dd�}
d|kr^|jdd�|d<nd|krd|krtjd|d�ttjjd||��\|d<|d<|jd�}d|kr�dj||dg�}nt|d|d|�nd|kr3tjjd ||�|d<ntjjd!||�}i#|d"6|d#6tjjd$||dd%�d&6|jd'|�d'6|
d(6|	d 6|d6|dd6|d)6tjjd*||dd+�d*6|d,6|d-d-6|d.d.6|d/d/6|d0d06|dd16|dd26tjjd3||ddo�d36|d4d46tjjd5||d|
dk�d56tjjd6||ddo�d66tjjd7||dt�d76tjjd||d
t�d6|d	6tjjd8||�d86tjjd9||�d96|d:6tjjd;||dt�d;6|jd<do�d<6tjjd=||dt�d=6tjjd>||dd?�d>6tjjd@||ddo�d@6tjjdA||ddB�dC6tjjdD||dg�dD6i|dd6|dEdE6|dFdF6dG6}
|
j�}dH|kr4|
ji|dHdH6�ntjjdI||�tkr�t|
dI<|dJ|
dJ<|dK|
dK<t||�}||
dL<|jdMdo�r�t|
dN<q�ntjjdO||dt�|
dO<|r�dP|
dA<ntjjdQ||�}|r@tjjdR||ddS�|
d&<||
dQ<t||�}|dT|
dT<tjjdU||ddV�|
d(<tjjd||ddW�}|r�||
d<ntjjdX||dt�|
dX<tjjdY||ddZ�|
dY<tjjd[||dt�|
d[<tjjd\||dt�|
d\<|r@d]|
d^<q@ntj|
�}|d"=|d1=|d2=|d6=d|kr�|d=n||d_<td`dadbj|d�dci|dd6de|jd/tj	jtd/dT��df|jdgdh��|r;	|tkr;	t|�}|tk	r-	tjdi|d�nt|dj<|S|rP	t |
�}nt!|
�}|r�	t|�}|tk	r�	tjdi|d�q�	n|tk	r�	t|dj<|tk	r�	|j|�ntjdk|d�|Stj"dl|d�iidmj|d�dn6d6S(pu�
    This is the primary entry point for logging into any system (POSIX or
    Windows) to install Salt. It will make the decision on its own as to which
    deploy function to call.
    udeployR^u
inline_scriptu''deploy' is not enabled. Not deploying.u	No DeployuErrorudriverusaltifyukey_filenameR_ussh_keyfileu,The defined ssh_keyfile '{0}' does not existu	ssh_agentu
SSH_AUTH_SOCKupassworduwin_passwordu�Cannot deploy Salt in a VM if the 'key_filename' setting is not set and there is no password set for the VM. Check the provider docs for 'change_password' option if it is supported by your provider.uosubootstrap-saltussh_usernameurootufile_transportusftpupub_keyupriv_keyuGenerating keys for '%s'unameukeysizeu
append_domainu.upki_diruscriptussh_hostuoptsuhostussh_portiuportu	salt_hostuusernameu
has_ssh_agentutmp_diru/tmp/.saltclouduvm_ustart_actionuparallelusock_diru	conf_fileu
minion_pemu
minion_pubumaster_sign_pub_fileukeep_tmpusudou
sudo_passworduttyuscript_argsu
script_envuminion_confuforce_minion_configupreseed_minion_keysudisplay_ssh_outputuknown_hosts_fileu	/dev/nullufile_mapuwait_for_passwd_maxtriesiumaxtriesupreflight_cmdsuprovideruprofileucloud_grainsugatewayumake_masteru
master_pubu
master_pemumaster_confu
syndic_masterumake_syndicumake_minioniu
win_installerusmb_porti�umasteruwin_usernameu
Administratoruu	use_winrmu
winrm_portibu
winrm_use_ssluwinrm_verify_ssliuport_timeoutu
deploy_kwargsueventuexecuting deploy scriptusalt/cloud/{0}/deployingtargsukwargstsock_dirt	transportu	transportuzeromqu#Inline script(s) ha(s|ve) run on %sudeployeduSalt installed on %suFailed to start Salt on host %su Failed to start Salt on host {0}uNot DeployedN(#Rbt__opts__RR`RaRuR+RdR9R#R;RR-tenvirontstattS_ISSOCKtst_modeR
RhR?RRXRCR<RWRlRcRpRmt
fire_eventtrun_inline_scriptRtdeploy_windowst
deploy_scriptterror(R$Rt
deploy_configtinline_script_configtsaltify_drivertkey_filenamet
has_ssh_agenttrettminion_conftdeploy_script_codetssh_usernametkey_idthostt
deploy_kwargstinline_script_kwargstmaster_conft
win_installerRtwin_passtevent_kwargstinline_script_deployedtdeployed((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt	bootstrap{s�						"																								

	
		
		
				




cC@s�|dkrdg}ntjjd||�}t|t�sK|g}ng|D]}|rR|^qR}|}x*|D]"}||krx|j|�qxqxW|j|�|S(uT
    Return the ssh_usernames. Defaults to a built-in list of users for trying.
    urootussh_usernameN(RbRR`Rat
isinstancetlisttappendtextend(R$Rt
default_userst	usernamestxtinitialtname((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
ssh_usernames�s	

i�cK@s�tj�}tjd|�d}x�tr�|d7}y#||�}t|t�sW|SWnCtk
r�}tjd|�tjd�tjd||�nXtj�||kr%tjd|�t	Sq%WdS(u6
    Wait until a function finishes, or times out
    uAttempting function %siiu$Caught exception in wait_for_fun: %su!Retrying function %s on  (try %s)uFunction timed out: %sN(
ttimeRRXRdR�tboolt	ExceptiontsleepR�Ru(tfunttimeoutR.tstartttrycounttresponsetexc((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytwait_for_fun�s 	

ic	C@s0tj�}|}|}|r�|d}d}d|krR|jd�\}}nd|krk|d}n|}|}tjd||||�ntjd||�d}	xYtr|	d7}	yLtjtj|�r�tjtjtj�}
ntjtj	tj�}
Wn,tj
k
r9tjtj	tj�}
nXyE|
jd	�|
j|t
|�f�|
jtj�|
j�PWq�tj
k
r}tjd
|�tjd�tj�||kr�tj
d|�tStjd|r�d
nd|||	�q�Xq�W|stStjd||�g}|jdddg�d|kr||jddddddj|d�g�ndj||�}
djdj|�|d||tjd��}djdj|�|d||tj|
��}tjd|�itd 6|jd!d'�d"6}d}	t}d	}x�tr+|	d7}	|s�t|d#t|�}|dkrut}n|d8}tj
d$|�|s�td%��q�n|r�t|d#t|�}|dkr�tSntjd�tj�||krtj
d|�tStjd&|||||	�q5Wd'S((u
    Wait until a connection to the specified port can be made on a specified
    host. This is usually port 22 (for SSH), but in the case of Windows
    installations, it might be port 445 (for psexec). It may also be an
    alternate port for SSH, depending on the base image.
    ussh_gatewayiu:ussh_gateway_portuEAttempting connection to host %s on port %s via gateway %s on port %su+Attempting connection to host %s on port %siiiu%Caught exception in wait_for_port: %suPort connection timed out: %su0Retrying connection to %s %s on port %s (try %s)ugatewayuhostu#Gateway %s on port %s is reachable.u-oStrictHostKeyChecking=nou-oUserKnownHostsFile=/dev/nullu-oControlPath=noneussh_gateway_keyu-oPasswordAuthentication=nou$-oChallengeResponseAuthentication=nou-oPubkeyAuthentication=yesu-oIdentitiesOnly=yesu!-oKbdInteractiveAuthentication=nou-i {0}unc -z -w5 -q0 {0} {1}ussh {0} {1}@{2} -p {3} {4}u ussh_gateway_userudateuSSH command: '%s'udisplay_ssh_outputussh_gateway_passwordupasswordt
allow_failureuAGateway usage seems to be broken, password error ? Tries left: %su-SSH gateway is reachable but we can not loginuMRetrying connection to host %s on port %s via gateway %s on port %s. (try %s)N(R�R,RRXRdtsockett	inet_ptontAF_INET6tSOCK_STREAMtAF_INETR�t
settimeouttconnecttinttshutdownt	SHUT_RDWRtcloseR�RuR�R-R<tpipestquoteR+Rbt
_exec_ssh_cmdR(R�tportR�R(R�t
test_ssh_hostt
test_ssh_portR0R1R�tsockR�tssh_argstcommandtpcmdtcmdR.tusable_gatewaytgateway_retriestpstatuststatus((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
wait_for_port�s�

	



$

	
	

RcB@sYeZdZd
d
ded
d�Zd�Zd�Zd�Zd�Z	ddd	�Z
RS(ut
    Wrap pypsexec.client.Client to fix some stability issues:

      - Set the service name from a keyword arg, this allows multiple service
        instances to be created in a single process.
      - Keep trying service and file deletes since they may not succeed on the
        first try. Raises an exception if they do not succeed after a timeout
        period.
    i�cC@s[||_dj|j�|_t|||||�|_t|j|jj�|j_dS(Nu{0}.exe(tservice_nameR-t	_exe_filetPsExecClientt_clienttScmrServicetsessiont_service(tselftservertusernametpasswordR�tencryptR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt__init__gs	cC@s
|jj�S(N(R�R�(R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�nscC@s
|jj�S(N(R�t
disconnect(R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�qscC@s
|jj�S(N(R�tcreate_service(R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�tscO@s|jj||�S(N(R�trun_executable(R�RwR.((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�wsi
icC@s�tjd�tj�}xztr�y|jjj�WnXtk
r�}tjdt|��tj�||kr}|�ntj	|�qnXPqWt
|jjdj|jj
j��}tjd|j�|j�tj�}x�tr{y'tjd�|jj||j�Wn^tk
rv}tjd|jt|��tj�||krc|�ntj	|�q�nXPq�Wtjd|j�|j�dS(	u�
        Removes the PAExec service and executable that was created as part of
        the create_service function. This does not remove any older executables
        or services from previous runs, use cleanup() instead for that purpose.
        u1Deleting PAExec service at the end of the processu/Exception encountered while deleting service %su\\{0}\ADMIN$uConnecting to SMB Tree %su7Creating open to PAExec file with delete on close flagsuException deleting file %s %suDisconnecting from SMB Tree %sN(RRXR�RdR�R�tdeleteRtreprR�RR�R-t
connectiontserver_nameRt
share_nameR�t_delete_fileR�RR�(R�twait_timeoutt
sleep_waitt
wait_startR�tsmb_tree((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytremove_servicezs>
		
	
	
	
N(t__name__t
__module__t__doc__RbRdR�R�R�R�R�R�(((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR\s						i�c	C@sadj|||�}dj||�}dj|||�}dj|||�}t|d|�S(u9
    Run a command remotly via the winexe executable
    u-U '{0}%{1}' //{2}u-U '{0}%XXX-REDACTED-XXX' //{1}uwinexe {0} {1} {2}tlogging_command(R-twin_cmd(	R�RwR�R�R�R�tcredst
logging_credstlogging_cmd((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytrun_winexe_command�s		cC@s�t�r8tr8t||||||�}dd|fSdjtj��}d\}}	}t|||d|dtd|�}
|
j	�z)|
j
�|
j||�\}}	}Wd|
j�|
j
�X||	|fS(u9
    Run a command remotly using the psexec protocol
    uPS-Exec-{0}uR�R�R�N(uuN(R7t
HAS_PSEXECR�RbR-tuuidtuuid4RRuR�R�R�R�R�(R�RwR�R�R�R�tret_codeR�tstdouttstderrtclient((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytrun_psexec_command�s
$


c	C@s�tj�}tjd||�d}x�tr�|d7}yLtdd||||�}|dkrstjd�tStjd|�Wn&tjk
r�}tjd|�nXtj�||kr�tStjd�q(Wd	S(
u:
    Wait until winexe connection can be established.
    u2Attempting winexe connection to host %s on port %siiuscuquery winexesvcuwinexe connected...uReturn code was %su*Caught exception in wait_for_winexesvc: %sN(	R�RRXRdR�R�R�RuR�(	R�R�R�R�R�R�t	try_countR�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytwait_for_winexe�s&
	

c	C@st�r&tr&t|||||�Stj�}d}x�tr|d7}d}y+tdd|||d|�\}}	}Wn tk
r�}
tjd�nX|dkr�tj	d�tStj�||kr�t
Stj	dj|||��tjd�q;Wd	S(
u:
    Wait until psexec connection can be established.
    iiucmd.exeu/c hostnameR�uUnable to execute commandupsexec connected...u<Retrying psexec connection to host {0} on port {1} (try {2})N(
R7R�R�R�RdR�R�Rt	exceptionRXRuR-R�(R�R�R�R�R�R�R�R�R�R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytwait_for_psexecsvc�s.	
(

cC@s�td|d|d|�tj�}tjd||�d}|sMd}nd}	xUtr�|	d7}	y�i|d	6||fd
6|d6}
|s�tjd�d
|
d<ntj|
�}t|jd�r�|jj	d�ntj
d|j�|jd�}|j
dkr tjd�|Stjd|j
�Wn#tk
rY}
tjd|
�nXtj�||kr�tjd|�dStjd|||	�tjd�qVWdS(u9
    Wait until WinRM connection can be established.
    R�R�R�u1Attempting WinRM connection to host %s on port %sussluntlmiiutargetuauthu	transportu"SSL validation for WinRM disabled.uignoreuserver_cert_validationuset_timeoutiuWinRM endpoint url: %susc query winrmuWinRM session connected...uReturn code was %su&Caught exception in wait_for_winrm: %suWinRM connection timed out: %su8Retrying WinRM connection to host %s on port %s (try %s)N(R�R�RRXRdtwinrmtSessionthasattrtprotocoltset_timeoutttraceturltrun_cmdtstatus_codeRR�RbR�(R�R�R�R�R�tuse_ssltverifyR�RyR�twinrm_kwargststrR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytwait_for_winrmsH
		







u
Administratori
c	C@sZdj|||�}dj||�}x&t|�D]}t|d|�}q4W|dkS(u4
    Check if the windows credentials are valid
    u$winexe -U '{0}%{1}' //{2} "hostname"u1winexe -U '{0}%XXX-REDACTED-XXX' //{1} "hostname"R�i(R-RR�(	R�R�R�tretriestretry_delayR�R�tiR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytvalidate_windows_cred_winexe:s		
c
	C@s�x�t|�D]w}d}y+tdd|||dd�\}}}Wn tk
rf}	tjd�nX|dkrwPntj|�q
W|dkS(u4
    Check if the windows credentials are valid
    iucmd.exeu/c hostnameR�i�u!Exceoption while executing psexeci(RR�R�RR�R�R�(
R�R�R�RR	R
R�R�R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytvalidate_windows_credSs(iurootu	/dev/nullcC@s�d}x�||kr�t}
y]i	|d6|d6|d6|d6|d6|d6|
d6|d	6|d
6}|jt|	��|r�tjj|�s�tdj|���n||d<tj	d
|�n |r�||d<tj	d�n|d7}tj	d|||�t
ddtdt|�}|dkrct}
||krOtj
|�w	ntjd|�tS|
tkrstStSWq	tk
r��q	tk
r�||kr�tStj
|�q	Xq	WdS(uK
    Wait until ssh connection can be accessed via password or ssh key
    iuhostnameuportuusernameupassword_retriesutimeoutudisplay_ssh_outputuknown_hosts_fileussh_timeoutuhard_timeoutu-The defined key_filename '{0}' does not existukey_filenameuUsing %s as the key_filenameupassworduUsing password authenticationiu/Attempting to authenticate as %s (try %s of %s)udatetttytsudou%Authentication failed: status code %sN(RuRcR*R9R#R;RR-RRXtroot_cmdRdR�R�R�RR�(R�R�tssh_timeoutR�R�R�tmaxtriesttrysleeptdisplay_ssh_outputR(tknown_hosts_filethard_timeoutR�tconnectfailR.R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytwait_for_passwdisZ








u
C:\salttmpibc-K@st|t�si}n|r6tr6tjd�tS|rft�rftrftj	j
jdd�ntj
tj��}tjd||�tjdt|�td|d|d|d	�}|s�tSt}dH}tr1|r1td|d|d
|d|d|d	d|d
|�}|dHk	r\t}q\n+td|d|d
|d|d|d	�}|r|rtjd||�tjd|||�|tj
tj��|} tj	jj|||�}!|!tkr�tjd�tStj	jjdd|!�tj	jjdd|!�|
r=tj	jj|
dd|!�n|rbtj	jj|dd|!�n|r�tjd|�y#tj	jj|ddd|!�Wq�tk
r�}"tjd|�q�Xn|jd�}#dj|#d �}$|#d}%tj	jj|dj|%�dd|!�|rUt|dj|%�ddj|�d j|�g�nfdj|%�}&d!j||�}'t |&|'|||�\}(})}*|*d"kr�td#j|*���n|r~t|t�s�t!d$��n|j"d%i�}+|+r"tj	jjt#|+d&d'�d(d|!�nid)d*6d+d,6d-d.6td/6},t||,�}tj	jjt#|d&d'�d0d|!�n|
s�|r�t|d1d2dd3g�q�tj	jj$dj|%�dd|!�tj	jj%ddd|!�n|r,t|d4d5d6g�tj&d7�t|d4d8d6g�n|t d9d:|||�\}(})}*|*d"kr]tStj&d7�tjd;�t d9d<|||�\}(})}*|*d"kr�tSt'd=d>j||�d?j|�d@i|dA6dB|j(dCt)j*jt+dCdD��dE|j(dFdG��tStS(IuJ
    Copy the install files to a remote Windows box, and execute them
    u6WinRM requested but module winrm could not be importeduSodiumufSupport for winexe has been deprecated and will be removed in Sodium, please install pypsexec instead.uDeploying %s at %s (Windows)uHAS_WINRM: %s, use_winrm: %sR�R�R�i<R�R�RRuSMB port %s on %s is availableuLogging into %s:%s as %su6Please install smbprotocol to enable SMB functionalityusalttemptconnusalt/conf/pki/minionusalt\conf\pki\minion\minion.pubusalt\conf\pki\minion\minion.pemu.Copying master_sign.pub file from %s to minionu$salt\conf\pki\minion\master_sign.pubuC$u3Exception copying master_sign.pub file %s to minionu/i����usalttemp\{0}uc:\salttemp\{0}u/Su/master={0}u/minion-name={0}u/S /master={0} /minion-name={1}iuFail installer {0}up`salt.utils.cloud.deploy_windows` now only accepts dictionaries for its `minion_conf` parameter. Loading YAML...ugrainsRqu
usalt\conf\grainsutcpuipc_modeuc:\salturoot_diru/conf/pki/minionupki_dirumultiprocessingusalt\conf\minionurmdiru/QuC:\salttemp\uscustopusalt-minioniustartucmd.exeu/c sc stop salt-minionu Run psexec: sc start salt-minionu/c sc start salt-minionueventu{0} has been deployed at {1}usalt/cloud/{0}/deploy_windowsRwunameRxusock_dirumasterRyu	transportuzeromqN(,R�tdictt	HAS_WINRMRR�RuR7R�RRtversionst
warn_untilR�tmktimet	localtimeRXR�R�RbRRdR�tsmbtget_conntmkdirstput_strtput_fileR�R,R<R-t	winrm_cmdR�tDeprecationWarningtpopR8tdelete_filetdelete_directoryR�RR+R9R#Rz(-R�R�R�R�R�R�Rxt	conf_filetstart_actiontparallelt
minion_pubt
minion_pemR�tkeep_tmptscript_argst
script_envtport_timeouttpreseed_minion_keysR�Rottmp_dirRtmaster_sign_pub_filet	use_winrmt
winrm_portt
winrm_use_ssltwinrm_verify_sslR.t	starttimetport_availabletservice_availablet
winrm_sessiont
newtimeouttsmb_conntetcompst
local_patht	installerR�RwR�R�R�t
minion_grainstwindows_minion_conf((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR��s�	


	


!


%



u/tmp/.saltcloudc'HK@s"t|!t�si}!n| p!i} |%p-i}%dj|"jd�tj��}"tjjd| |!dt	j
j|"d��}(|d�k	r�t	j
j
|�r�tdj|���nd�})d|'kr�|'d})ntj�}*tjd|tjd	|*��|'jd
d�}+|!jdd��},td
|d|d|)�rtjd||�t|d|d|d|d|d|d|d|)d|+d|d|,�
rtjd|||�i|d6|d6|d6|d6|d6|d6|!jd t�d!6}-|-jt|)��|r(tjd"|�||-d#<n+|rS|'jd$t�tkrS||-d%<ntd&j|"�||d't|-�r�td(j|"�|||-�}.|.r�td)j|"���q�n|r\|"jd�jd�jd�}/t|/�d*kr\t|/�d+ks|/d*d,krYtd-j||"�|||-�}.|.rVtd.j||"���qVqYq\nt|#t�sti}#ng}0g}1g}2xR|#D]J}3|3}4|#|3}5t	j
j |3�s�tj!d/|4|5�|2j"i|5|46�q�nt	j
j#|4�r*t	j
j$|4�}6t	j
jt	j
j%|5�|6�}7nt	j
j%|5�}7|7|0kr�td0j|7�|||-�|-dd1kr�td2j|-d|7�|||-�n|0j"|7�nt&|!|5d3|-d4|4�|1j"i|5|46�q�W|r<t&|!d5j|"�||-�td6j|"�|||-�}.|.r<td7j|"���q<n|rat&|!d8j|"�||-�n|$r�t&|!d9j|"�d3|-d4|$�n|r>t|t�s�t'd:��n|j(d;i�}8|8r�t&|!d<j|"�t)|8�|-�n|%r|!jd=t�ri|%d>6|d;<nt&|!d?j|"�t)|�|-�n|r�t&|!d@j|"�||-�tdAj|"�|||-�}.|.r�tdBj|"���q�n|
r�t&|!dCj|"�|
|-�n|r
t|t�s�t'dD��nt&|!dEj|"�t)|�|-�ndFj|"�}9|d�k	rntdGj|9�|||-�}.|.rdtdHj|9���ntdIj|9�|||-�}.|.r�tdJj|9���n|-dd1kr�td2j|-d|9�|||-�nxEt*j+|�D]4\}:};t	j
j|9|:�}<t&|!|<|;|-�q�W|-dd1krntdKj|9�|||-�|.rktdLj|9���qkqnn|'jdMg�}=xA|=D]9}>t|>|||-�}?|?r�tdNj|>���q�q�W|r%	t&|!dOj|"�||-�tdPj|"�|||-�}.|.r%	tdQj|"���q%	ntj,tj��tj,|*�}@||@}Ad�}Bd�}C|r�	|r�	t-j.�}Bt-j/dRt0d3tdS|dT|dU|AdV|B��}CtjdW�|Cj1�n|r%dX|kr�
|(dYj|"�7}(|&r�	|(dZ7}(n|tkr
|(d[7}(n|tkr-
|(d\7}(n|tkrF
|(d]7}(n|tkr_
|(d^7}(n|d�k	r�
|(d_j|9�7}(q�
n|r�
|(d`j|�7}(n|rut|t�s�
tdajt2|����ndbg}Dx6t*j+|�D]%\}E}F|Dj"dcj|E|F��q�
W|Dj"|(�t&|!ddj|"�dej|D�|-�tdfj|"�|||-�dgj|"�}(nt|(|||-�d*kr�tdhj|(���ntjdi|(�|s%tdjj|"�|||-�tjdk|"�|r"tdlj|"�|||-�tjdm|"�q"q%n|r>tjdn|"�n�|rstdoj|"�|||-�tjdp|"�n|r�tdqj|"�|||-�tjdr|"�n|r	
tdsj|"�|||-�tjdt|"�tduj|"�|||-�tjdv|"�n|$r>
tdwj|"�|||-�tjdx|"�n|
rs
tdyj|"�|||-�tjdz|"�n|r�
td{j|"�|||-�tjd||"�n|r�
td}j|"�|||-�tjd~|"�n|d�k	rtdj|9�|||-�tjd�|9�n|r�|r�|Bj�}G|Cj�|Gr�|r�tj3d�|�td�j|�|||-�tj3d�|�q�nt4d�d�j||�d�j|�d�i|d�6|d�6dT|!jd�t	j
jt5d�d���d�|!jd�d���|2s|1ri|1d�6|2d�6StSntS(�uL
    Copy a deploy script to a remote server, execute it, and remove it
    u{0}-{1}u/udeploy_commandR^u	deploy.shu-The defined key_filename '{0}' does not existugatewayuDeploying %s at %su%Y-%m-%d %H:%M:%Suknown_hosts_fileu	/dev/nulluhard_timeoutR�R�R(uSSH port %s on %s is availableR�R�R�RRRRRuLogging into %s:%s as %suhostnameuportuusernameutimeoutudisplay_ssh_outputu
sudo_passworduuse_sftpusftpuUsing %s as the key_filenameukey_filenameu
has_ssh_agentupasswordu
test -e '{0}'R�u!sh -c "( mkdir -p -m 700 '{0}' )"u)Can't create temporary directory in {0} !iiutmpuchown {0} "{1}"uCant set {0} ownership on {1}uWThe local file "%s" does not exist, and will not be copied to "%s" on the target systemumkdir -p '{0}'urootuchown {0} '{1}'R.t
local_fileu{0}/minion.pemuchmod 600 '{0}/minion.pem'u!Can't set perms on {0}/minion.pemu{0}/minion.pubu{0}/master_sign.pubuo`salt.utils.cloud.deploy_script now only accepts dictionaries for it's `minion_conf` parameter. Loading YAML...ugrainsu
{0}/grainsuenable_cloud_grainsu
salt-cloudu
{0}/minionu{0}/master.pemuchmod 600 '{0}/master.pem'u Cant set perms on {0}/master.pemu{0}/master.pubuu`salt.utils.cloud.deploy_script now only accepts dictionaries for it's `master_conf` parameter. Loading from YAML ...u
{0}/masteru{0}/preseed-minion-keysumkdir '{0}'uCant create {0}uchmod 700 '{0}'uCan't set perms on {0}uchown -R root '{0}'uCan't set ownership for {0}upreflight_cmdsu Pre-flight command failed: '{0}'u
{0}/deploy.shu,sh -c "( chmod +x '{0}/deploy.sh' )";exit $?u Can't set perms on {0}/deploy.shttargetR�RxR�tqueueu,Starting new process to wait for salt-minionubootstrap-saltu	 -c '{0}'u -Fu -Su -Mu -Nu -Ku	 -k '{0}'u {0}uIThe 'script_env' configuration setting NEEDS to be a dictionary not a {0}u	#!/bin/shu4setenv {0} '{1}' >/dev/null 2>&1 || export {0}='{1}'u{0}/environ-deploy-wrapper.shu
u(chmod +x '{0}/environ-deploy-wrapper.sh'u'{0}/environ-deploy-wrapper.sh'u"Executing the command '{0}' faileduExecuted command '%s'urm -f '{0}/deploy.sh'uRemoved %s/deploy.shu%rm -f '{0}/environ-deploy-wrapper.sh'u$Removed %s/environ-deploy-wrapper.shu&Not removing deployment files from %s/urm -f '{0}/minion.pub'uRemoved %s/minion.puburm -f '{0}/minion.pem'uRemoved %s/minion.pemurm -f '{0}/grains'uRemoved %s/grainsurm -f '{0}/minion'uRemoved %s/minionurm -f {0}/master_sign.pubuRemoved %s/master_sign.puburm -f '{0}/master.pub'uRemoved %s/master.puburm -f '{0}/master.pem'uRemoved %s/master.pemurm -f '{0}/master'uRemoved %s/masterurm -rf '{0}'u
Removed %suExecuting %s on the salt-minionu
salt-call {0}u(Finished executing %s on the salt-minionueventu{0} has been deployed at {1}usalt/cloud/{0}/deploy_scriptRwunameuhostusock_dirumasterRyu	transportuzeromquFile Upload SuccessuFile Upload FailureN(6R�RR-trstripR�R�RR`RaR9R#R<RbR;RR�RRRXtstrftimeR+R�RRuRcR*RRdR
tlstripR,tlenRLR�R�tisdirtbasenametdirnametssh_fileR%R&R8Rt	iteritemsRtmultiprocessingtQueuetProcesst
check_authR�ttypeRRRz(HR�R�R�R�R�R�tscriptR�RxtproviderR)R*Rgt
master_pubt
master_pemR�R,R-R�R.R/R0RRtmake_syndictmake_minionRR2R+t
sudo_passwordRR
R$RR3tfile_mapR4tcloud_grainstforce_minion_configR.tdeploy_commandR(R9RRt
ssh_kwargsR�R@tremote_dirstfile_map_successt
file_map_failtmap_itemREtremote_filetdir_namet
remote_dirRCtpreseed_minion_keys_tempdirt	minion_idt
minion_keytrpathtpreflight_cmdsR�tcmd_rett	time_usedR=RGtprocesstenviron_script_contentsRUtvaluetqueuereturn((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�rs�+	!	


!"	



%	
	
	
	
	

"

	






		

















u/tmp/.saltcloud-inline_scriptcK@s`d"}d|kr|d}ntjtj��}tjd||�|jdd�}td|d|d|�r\tjd||�|tjtj��|}t|d|d	|d
|d|d|d
|d|d|�r\tjd|||�|tjtj��|}i|d6|d6|d6|d6|d6|
d6|jdt	�d6}|j
t|��|r�tjd|�||d<n/|r�d|kr�|dt	kr�||d<ntdj
|�|
|dt|�rY|rYtjd�xa|D]V}tjd|�td j
|�|
|dt|�}|r�tjd!||�q�q�WqYq\ntS(#u�
    Run the inline script commands, one by one
    :**kwargs: catch all other things we may get but don't actually need/use
    ugatewayuDeploying %s at %suknown_hosts_fileu	/dev/nullR�R�R(uSSH port %s on %s is availableR�R�R�RRRuLogging into %s:%s as %suhostnameuportuusernameutimeoutudisplay_ssh_outputu
sudo_passworduuse_sftpusftpuUsing %s as the key_filenameukey_filenameu
has_ssh_agentupasswordutest -e \"{0}\"R�uFound inline script to execute.uExecuting inline command: %sush -c "( {0} )"u[%s] Output: %sN(RbR�RRRRXR+R�RRuRcR*RR-RdR(R�R�R�R�R�R�t
inline_scriptRRR+R\RR�R
RR3R.R(R9RR=Ratcmd_lineR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�QsP

"


#cC@s�i}g}t}xXtjdi�D]D}||kr=q%ntd|d}td|jdt�}q%W|tkr�g}nt|t�s�t|�}ntt||��}x+|D]#}||kr�||||<q�q�W|S(u�
    Accept a tag, a dict and a list of default keys to return from the dict, and
    check them against the cloud configuration for that tag
    u
filter_eventsukeysuuse_defaults(RdRzR+RuR�R�tset(ttagtdatatdefaultsR�tkeystuse_defaultstktagRU((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytfilter_event�s"	
uzeromqcC@s�tjjjd||dt�}y|j||�WnJtk
r�t|t�ra|||<n
i||6}|j||�nXt	j
d�dS(u
    Fire deploy action
    umastertlisteng�������?N(RRteventt	get_eventRuRt
ValueErrorR�RR�R�(RUtmsgRwRxRwRyR((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�s	


cK@s�|dkrd}n|jdd�}z�yid\}}tjjj|dtdtdtd|jdt�d	|jdt��}d
}x�|jrQ|j�\}}|rAt	j
|�rAd|kr�|dr�tj
|�r�|j|d�qA|jd
d�r2||kr2|d7}|j|d
�qAt
|��ntjd�q�W|jd
kr�|tkr�tdj||j���n|jSWnDtjjjk
r�}	tj�}
tj|j||	|
��nXWd|jdtdt�XdS(Nu@A wrong password has been issued while establishing ssh session.upassword_retriesitshellt
log_stdoutt
log_stderrt
stream_stdoutudisplay_ssh_outputt
stream_stderriukey_filenameu
sudo_passwordupasswordig�?u$Command '{0}' failed. Exit code: {1}t	terminatetkill(NN(RbR+RRtvttTerminalRdthas_unread_datatrecvtSSH_PASSWORD_PROMP_REtsearchtSSH_PASSWORD_PROMP_SUDO_REtsendlineRR�R�t
exitstatusRuR
R-tTerminalExceptiont	tracebackt
format_excRR�R�(R�t	error_msgR�R.tpassword_retriesR�R�tproct
sent_passwordterrR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR��sH	
$c	C@s{d}z|dk	r�z&tj�\}}tj||�Wdytj|�Wn.tk
r}|jtjkr�|�q�nXXnt	j
d||d�dddg}|dk	r�|}tjj|�r�|j
d�q�nd|kr|jd	d
ddd
dj|d�g�nd|krE|j
dj|d��n|j
t|��y=tjtj|d�r�dj|d�}n
|d}Wntjk
r�|d}nX|dkr�t	jd�ndjdj|�||||�}	t	j
d|	�t|	dddd|�}
Wd|dk	rvytj|�Wqvtk
rr}|jtjkrs|�qsqvXnX|
S(u4
    Use scp or sftp to copy a file to a server
    NuUploading %s to %suhostnameu-oStrictHostKeyChecking=nou-oUserKnownHostsFile=/dev/nullu-oControlPath=noneu-rukey_filenameu-oPasswordAuthentication=nou$-oChallengeResponseAuthentication=nou-oPubkeyAuthentication=yesu-oIdentitiesOnly=yesu!-oKbdInteractiveAuthentication=nou-i {0}uportu
-oPort={0}u[{0}]unNo source file to upload. Please make sure that either file contents or the path to a local file are provided.u�scp {0} {1} {2[username]}@{4}:{3} || echo "put {1} {3}" | sftp {0} {2[username]}@{4} || rsync -avz -e "ssh {0}" {1} {2[username]}@{2[hostname]}:{3}u uSCP command: '%s'R�u$Failed to upload file '{0}': {1}
{2}R�i(RbR@tmkstempR9RNR�tOSErrorterrnotEBADFRRXR#RLR�R�R-R5R�R�R�R�twarningR<R�RPtENOENT(t	dest_pathtcontentsR.REtfile_to_uploadttmpfdR�R�tipaddrR�tretcode((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytscp_filesj	
	
cC@s>|jdd�dkr+t||||�St||||�S(u]
    Copies a file to the remote SSH target using either sftp or scp, as
    configured.
    ufile_transportusftp(R+t	sftp_fileR�(RR�R�R.RE((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyROfsc	C@s�g}|dkri}nd}zW|dk	r�zTtj�\}}t|tj�rstj||jt	��ntj||�Wdytj
|�Wn.tk
r�}|jtj
kr�|�q�nXXn|dk	r|}tjj|�rdg}qntjd||jd��dddg}d|krf|jd	d
ddd
dj|d�g�nd|kr�|jdj|d��n|jt|��y=tjtj|d�r�dj|d�}	n
|d}	Wntjk
r�|d}	nX|dkrtjd�ndjdj|�||dj|�||	�}
tjd|
�t|
dddd|�}Wd|dk	r�ytj|�Wq�tk
r�}|jtjkr�|�q�q�XnX|S(u/
    Use sftp to upload a file to a server
    Nu-ruUploading %s to %s (sftp)uhostnameu-oStrictHostKeyChecking=nou-oUserKnownHostsFile=/dev/nullu-oControlPath=noneukey_filenameu-oPasswordAuthentication=nou$-oChallengeResponseAuthentication=nou-oPubkeyAuthentication=yesu-oIdentitiesOnly=yesu!-oKbdInteractiveAuthentication=nou-oIdentityFile={0}uportu
-oPort={0}u[{0}]unNo source file to upload. Please make sure that either file contents or the path to a local file are provided.u3echo "put {0} {1} {2}" | sftp {3} {4[username]}@{5}u uSFTP command: '%s'R�u$Failed to upload file '{0}': {1}
{2}R�i( RbR@R�R�Rtstring_typesR9RNtencodet__salt_system_encoding__R�R�R�R�R#RLRRXR+R�R-R�R5R�R�R�R�R�R<R�RPR�(R�R�R.REtput_argsR�R�R�R�R�R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�pst		
*	
cK@s�|jdd�}y�t|dtdtjdtjd|jdt�d|�}|dkrvtjd|j|�ntjd|j|�|j	�|j
�|jSWn#tk
r�}tj
d	|�nXd
S(u>
    Wrapper for commands to be run against Windows boxes
    ulogging_commandR�R�R�tstream_stdsudisplay_ssh_outputR�uExecuting command(PID %s): '%s'uFailed to execute command '%s'iN(R+RbR	Rdt
subprocesstPIPERRXtpidtpoll_and_read_until_finishtcommunicatet
returncodeR�R�(R�R.R�R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR��s,			


cK@s,tjd||�|j||�}|jS(uK
    Wrapper for commands to be run against Windows boxes using WinRM.
    uExecuting WinRM command: %s %s(RRXRR(R�R�tflagsR.R((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR$�sc
	K@s6|}|jdd�}|rs|dkrBdj|�}|}ndj|�}dj|�}tjd|�ng}|r�|jddg�n|jdd�}d	}	|dkr�d
}	n|jdj|	�dj|�d
g�d|kr%|jddddddj|d�g�nd|krQ|jdj|d�g�n|jt|�g�d|kr�|jdj|d�g�ndjdj|�|�}
|
|}|
tj	|�}
|jd�}|dk	r
dj||�}dj||
�}
ntjd|�t
|
d||�}|S( u0
    Wrapper for commands to be run as root
    u
sudo_passwordusudo {0}usudo -S "XXX-REDACTED-XXX" {0}usudo -S {0}uUsing sudo to run command %su-tuknown_hosts_fileu	/dev/nullunouyesu-oStrictHostKeyChecking={0}u-oUserKnownHostsFile={0}u-oControlPath=noneukey_filenameu-oPasswordAuthentication=nou$-oChallengeResponseAuthentication=nou-oPubkeyAuthentication=yesu-oIdentitiesOnly=yesu!-oKbdInteractiveAuthentication=nou-i {0}ussh_timeoutu-oConnectTimeout={0}uportu-p {0}u$ssh {0} {1[username]}@{1[hostname]} u uhard_timeoututimeout {0} {1}uSSH command: '%s'R�N(R+RbR-RRXR�R5R<R�R�R�(
R�R
RR�R.R�R\R�Rthost_key_checkingR�RR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�sZ		
  	
i,cC@s�tjjjd|dt�}tjtj��}|}tj	d|�x�|dkr�|tjtj��|}|j
dt�}|d	kr�qLn|ddj|�krL|j
|�d}tj	d|�qLqLWd	S(
u�
    This function is called from a multiprocess instance, to wait for a minion
    to become available to receive salt commands
    umasterR~u1In check_auth, waiting for %s to become availableitfullutagusalt/minion/{0}/startu&Minion %s is ready to receive commandsN(RRRt	SaltEventRdR�RRRRXR�RbR-tput(R�RxRGR�RR9R=R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyRTH	s
cC@s8d}x+|jd�D]}|dt|�}qW|S(u.
    Converts an IP address to an integer
    iu.i(R,R�(tipR�toctet((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt	ip_to_int\	scC@s�d|kr#|jd�rtStSt|�}d|koFdknrOtSd|kofdknrotSd|ko�dknr�tSd	|ko�d
knr�tStS(uT
    Determines whether an IP address falls within one of the private IP ranges
    u:ufe80:i
i���
I��I����I�I���ii���(t
startswithRuRdR�(R�taddr((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytis_public_ipf	scC@sFtjdj|��}|j|�rBtdj||���ndS(uF
    Check whether the specified name contains invalid characters
    u[^{0}]uW{0} contains characters not supported by this cloud provider. Valid characters are: {1}N(tretcompileR-R�R(R�t
safe_charstregexp((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
check_name�	s
cC@s�|dkrpdtjkr4djtjd�}qpy%djtjtj��j�}Wqptk
rlqpXn|dk	r�t	j
d||�nt	j
d|�dj|�}tj|dt
�dS(u1
    Remove a host from the known_hosts file
    uHOMEu{0}/.ssh/known_hostsu0Removing ssh key for %s from known hosts file %su-Removing ssh key for %s from known hosts fileussh-keygen -R {0}R�N(RbR9R{R-tpwdtgetpwuidtgetuidtpwd_dirR�RRXR�tcallRd(R�tknown_hostsR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
remove_sshkey�	s

ii<c	C@s_|d	krd
}n|d	kr*i}n|}x(trZtjdt|d�t|d��|||�}|tkr�tjd|�|d8}|dkr�td��q�n|d	k	r�|S|dkr�tdjt|d�t|d����nt	j
|�||8}|dkr3||9}||krD|d}ntjd|�q3q3Wd	S(us
    Helper function that waits for an IP address for a specific maximum amount
    of time.

    :param update_callback: callback function which queries the cloud provider
                            for the VM ip address. It must return None if the
                            required data, IP included, is not available yet.
    :param update_args: Arguments to pass to update_callback
    :param update_kwargs: Keyword arguments to pass to update_callback
    :param timeout: The maximum amount of time(in seconds) to wait for the IP
                    address.
    :param interval: The looping interval, i.e., the amount of time to sleep
                     before the next iteration.
    :param interval_multiplier: Increase the interval by this multiplier after
                                each request; helps with throttling
    :param max_failures: If update_callback returns ``False`` it's considered
                         query failure. This value is the amount of failures
                         accepted before giving up.
    :returns: The update_callback returned data
    :raises: SaltCloudExecutionTimeout

    u-Waiting for VM IP. Giving up in 00:%02d:%02d.i<u^'update_callback' has returned 'False', which is considered a failure. Remaining Failures: %s.iiu<Too many failures occurred while waiting for the IP address.u(Unable to get IP for 00:{0:02d}:{1:02d}.u3Interval multiplier in effect; interval is now %ss.N((RbRdRRXR�RuRRR-R�R�R(	tupdate_callbacktupdate_argst
update_kwargsR�tintervaltinterval_multipliertmax_failurestdurationRx((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytwait_for_ip�	sB			





	c	C@s�|dkrtd��nd|krOtdj|dddd���ni}xe|D]]}i}||}x:|D]2}tj|�|kry||}|||<qyqyW|||<q\W|S(uO
    Return a list of the VMs that are on the provider, with select fields
    uactionuDThe list_nodes_select function must be called with -f or --function.uerroru*An error occurred while listing nodes: {0}uErrorsuErroruMessage(R
R-RR (	tnodest	selectionR�R�tnodetpairsRxRURr((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytlist_nodes_select�	s"



g�?cC@s�tjd|�|d}tj�}xWtrtjj|�r{tj�||krktjd|�tStj	|�q)Pq)Wt
jjj
|d��WdQXdS(u�
    Lock a file; if it is already locked, then wait for it to become available
    before locking it.

    Note that these locks are only recognized by Salt Cloud, and not other
    programs or platforms.
    u Attempting to obtain lock for %su.lockuUnable to obtain lock for %suaN(RR�R�RdR9R#RLR�RuR�RRRR(tfilenameR�R�tlockR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt	lock_file
s
	cC@sXtjd|�|d}ytj|�Wn&tk
rS}tjd||�nXdS(u�
    Unlock a locked file

    Note that these locks are only recognized by Salt Cloud, and not other
    programs or platforms.
    uRemoving lock for %su.locku Unable to remove lock for %s: %sN(RR�R9RPR�(R�R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytunlock_file(
s
c

C@s=t|�}tjj|d�}t|�tjj|�r�tjrLdnd}tj	j
j||��+}tj	jj
tj|dt��}WdQXni}|jd�}	|jii|d6|d6|d	6|	d
d6|6�tjr�dnd
}tj	j
j||��}tj||dt�WdQXt|�dS(u�
    Add an entry to the cachedir index. This generally only needs to happen when
    a new instance is created. This entry should contain:

    .. code-block:: yaml

        - minion_id
        - profile used to create the instance
        - provider and driver name

    The intent of this function is to speed up lookups for the cloud roster for
    salt-ssh. However, other code that makes use of profile information can also
    make use of this function.
    uindex.purburtencodingNu:uiduprofileudriveriuprovideruwbuw(t
init_cachedirR9R#R<R�RLRtPY3RRRRRxtdecodetmsgpacktloadtMSGPACK_ENCODINGR,RctdumpR�(
RjtprofiletdriverRWtbaset
index_filetmodetfh_tindext
prov_comps((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytcachedir_index_add7
s&
-	c
C@st|�}tjj|d�}t|�tjj|�r�tjrLdnd}tj	j
j||��+}tj	jj
tj|dt��}WdQXndS||kr�||=ntjr�dnd}tj	j
j||��}tj||dt�WdQXt|�dS(uw
    Delete an entry from the cachedir index. This generally only needs to happen
    when an instance is deleted.
    uindex.purburR�Nuwbuw(R�R9R#R<R�RLRR�RRRRRxR�R�R�R�R�R�(RjR�R�R�R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytcachedir_index_delc
s
-
cC@s�|dkrtd}n|tjj|d�tjj|d�f}x@|D]8}tjj|�sutj|�ntj|d�qMW|S(uP
    Initialize the cachedir needed for Salt Cloud to keep track of minions
    ucachediru	requesteduactivei�N(RbRzR9R#R<RLRMtchmod(R�tneeded_dirstdir_((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�}
s

cC@s�|dkrtd}n|rb|dk	rbtjjjd|d|rV|jd�pYd�}nt|�i|d6|d6|d6}d	j|�}t	j
j|d
|�}tj
r�dnd}	tjjj||	��}
tj||
d
t�WdQXdS(u�
    Creates an entry in the requested/ cachedir. This means that Salt Cloud has
    made a request to a cloud provider to create an instance, but it has not
    yet verified that the instance properly exists.

    If the fingerprint is unknown, a raw pubkey can be passed in, and a
    fingerprint will be calculated. If both are empty, then the fingerprint
    will be set to None.
    ucachedirRUtsum_typeu	hash_typeusha256u	minion_idufingerprintuprovideru{0}.pu	requesteduwbuwR�N(RbRzRRRBt
pem_fingerR+R�R-R9R#R<RR�RRR�R�R�(RjRtfingerprinttpubkeyRWR�RxtfnameR#R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytrequest_minion_cachedir�
s
6

c
C@s�t|t�stS|dkr,td}ndj|�}tjj|||�}t	j
jj|d��+}t	j
j
jtj|dt��}WdQX|j|�t	j
jj|d��}tj||dt�WdQXdS(u�
    Changes the info inside a minion's cachedir entry. The type of cachedir
    must be specified (i.e., 'requested' or 'active'). A dict is also passed in
    which contains the data to be changed.

    Example:

        change_minion_cachedir(
            'myminion',
            'requested',
            {'fingerprint': '26:5c:8c:de:be:fe:89:c0:02:ed:27:65:0e:bb:be:60'},
        )
    ucachediru{0}.purR�Nuw(R�RRuRbRzR-R9R#R<RRRRRxR�R�R�R�RcR�(RjtcachedirRxR�R�R#R�t
cache_data((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytchange_minion_cachedir�
s
*
cC@si|dkrtd}ndj|�}tjj|d|�}tjj|d�}tj||�dS(u�
    Moves a minion from the requested/ cachedir into the active/ cachedir. This
    means that Salt Cloud has verified that a requested instance properly
    exists, and should be expected to exist from here on out.
    ucachediru{0}.pu	requesteduactiveN(RbRzR-R9R#R<RDtmove(RjR�R�tsrctdst((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytactivate_minion_cachedir�
s
cC@s�t|t�rtj|�ntjdt�tkr;dS|dkrTtd}nttj	td|��}dj
|�}x^d	D]V}tjj
|||||�}tjd|�tjj|�r�tj|�q�q�WdS(
u�
    Deletes a minion's entry from the cloud cachedir. It will search through
    all cachedirs to find the minion's cache file.
    Needs `update_cachedir` set to True.
    uupdate_cachedirNucachediru	providersu{0}.pu	requesteduactiveupath: %s(u	requesteduactive(R�RRzRcR+RuRbtnextRtiterkeysR-R9R#R<RRXRLRP(RjRWRR�R�R�R�R#((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytdelete_minion_cachedir�
s

c

C@s�|dkrt}n|jdt�tkr1dS|dkrYtjj|dd�}ni}x*tj|�D]}i||<tjj||�}x�tj|�D]�}|r�||kr�q�ni|||<tjj||�}x�tj|�D]�}tjj||�}	|d }
tj	r)dnd}t
jjj
|	|��7}t
jjjtj|dt��||||
<WdQXq�Wq�WqoW|S(	u�
    Return a list of minion data from the cloud cache, rather from the cloud
    providers themselves. This is the cloud cache version of list_nodes_full().
    uupdate_cachedirNucachediruactivei����urburR�(RbRzR+RuR9R#R<tlistdirRR�RRRRRxR�R�R�R�(
RRWR�tminionsR�tprov_dirtprovtmin_dirR�tfpathRjR�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytlist_cache_nodes_fulls,	

BcC@s|jdd�}|s!|}n|s6td��n|jd�sQd|kr�tjd�yddl}Wntk
r�id	d
6SX|j|�}|jdkr�idj||j�d
6S|j	}||kr�d
}qyt
jj|�}n�t
jj
|�rUtjjj|��"}tjjj|j��}WdQXt
jj|�}n$|}djtj|�j��}|s�td��nt
jjt
jjt�d�}t
jjt
jj|d�d�}	t
jj|dd�}
g}xj|jdg�D]V}|j|�r!qn||	|
fkrI|j|tf�q|j|tf�qW|	|kr�|j|	tf�n|
|kr�|j|
tf�ng}
g}xC|D];\}}||
kr�q�n
|
j|�|r>t
jj|�r>yt
j|�Wq>t t!fk
r:}tj"d|�q�q>Xnt#|�s`tjd|�q�nt
jj||�}yN|j|�tjjj|d��#}|j$tjjj%|��WdQXWq�t t!fk
r�}tjd|�q�q�Xq�Wii|d6d6S(u�
    Update the salt-bootstrap script

    url can be one of:

        - The URL to fetch the bootstrap script from
        - The absolute path to the bootstrap
        - The content of the bootstrap script
    ubootstrap_script_urluhttps://bootstrap.saltstack.comuCant get any source to updateuhttpu://u6Updating the bootstrap-salt.sh script to latest stableiNuZUpdating the bootstrap-salt.sh script requires the Python requests library to be installeduerrori�ufFailed to download the latest stable version of the bootstrap-salt.sh script from {0}. HTTP error: {1}ubootstrap-salt.shu{0}.shu No content in bootstrap script !udeployu	conf_fileucloud.deploy.du
config_dirudeploy_scripts_search_pathuFailed to create directory '%s'u(The '%s' is not writeable. Continuing...uwu&Failed to write the updated script: %su
Files updateduSuccess(&R+R�R�RRXtrequeststImportErrorRR-ttextR9R#RMRLRRRRRRRthashlibtsha1t	hexdigestR<RNt__file__R�RdRuRLRMR�tIOErrorRR
RNRO(R`R�tdefault_urlRtreqtscript_contenttscript_nametfictbuiltin_deploy_dirtdeploy_d_from_conf_filetdeploy_d_from_syspathstdeploy_scripts_search_pathstentrytfinishedt
finished_fullRMR�tdeploy_pathR%((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytupdate_bootstrap&s�
			

			!						


&c
C@s7d|ks|drdStjjt�d�}ttj|d|��}tjj|||�}tjj|�s�tj|�nt	||||�x�|D]�}t
|||||�tjj|dj|��}tjr�dnd}t
jjj||��!}	tj|||	dt�WdQXq�WdS(	u�
    If configured to do so, update the cloud cachedir with the current list of
    nodes. Also fires configured events pertaining to the node list.

    .. versionadded:: 2014.7.0
    uupdate_cachedirNuactiveu	providersu{0}.puwbuwR�(R9R#R<R�R�RR�RLRMtmissing_node_cachetdiff_node_cacheR-R�RRRRR�R�R�(
R�RWRR�R�RR�R#R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytcache_node_list�s
c	
C@sCt|t�rtj|�ndtks6tdr:dStjjtjjtdd��sit�ntjjtdd�}|j	d�\}}tjj|||�}tjj|�s�tj
|�ntjj|dj|d��}tj
rdnd	}tjjj||��}tj||d
t�WdQXdS(uA
    Cache node individually

    .. versionadded:: 2014.7.0
    uupdate_cachedirNucachediruactiveu:u{0}.punameuwbuwR�(R�RRzRcR9R#RLR<R�R,RMR-RR�RRRRR�R�R�(	R�RWRR�R�RR#R�R�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt
cache_node�s%
"cC@s�g}x4tj|�D]#}|jtjj|�d�qWx�|D]�}||krDt|||�d|kr�|dr�tdddj|�di|d6d|jd	tjj	t
d	d
��d|jdd
��q�qDqDWdS(ug
    Check list of nodes to see if any nodes which were previously known about
    in the cache have been removed from the node list.

    This function will only run if configured to do so in the main Salt Cloud
    configuration file (normally /etc/salt/cloud).

    .. code-block:: yaml

        diff_cache_events: True

    .. versionadded:: 2014.7.0
    iudiff_cache_eventsueventu!cached node missing from provideru!salt/cloud/{0}/cache_node_missingRwumissing nodeRxusock_dirumasterRyu	transportuzeromqN(R9RR�R#tsplitextRRR-R+R<Rz(Rt	node_listRWRtcached_nodesR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR�s !

c	C@s�d|ks|drdS|dkr+dSdjtjj||��}tjj|�s�t||�}tdddj|�di|d6d	|jd
tjjt	d
d��d|jd
d��dSt
jjj
|d��Y}y(t
jjjtj|dt��}Wn'tk
r7tjd|�i}nXWdQXt
jjj||�}|dkr�tdddj|�dit||�d6t||�d6d	|jd
tjjt	d
d��d|jd
d��ndS(uX
    Check new node data against current cache. If data differ, fire an event
    which consists of the new node data.

    This function will only run if configured to do so in the main Salt Cloud
    configuration file (normally /etc/salt/cloud).

    .. code-block:: yaml

        diff_cache_events: True

    .. versionadded:: 2014.7.0
    udiff_cache_eventsNu{0}.pueventunew node foundusalt/cloud/{0}/cache_node_newRwunew_dataRxusock_dirumasterRyu	transportuzeromqurR�u"Cache for %s was corrupt: Deletingiunode data differsusalt/cloud/{0}/cache_node_diffu
cache_data(RbR-R9R#R<RLt_strip_cache_eventsRR+RzRRRRRxR�R�R�R�R�RR�tcompattcmp(	RR�tnew_dataRR#t
event_dataR�R�tdiff((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyRsH
(
cC@sLtj|�}|jdg�}x$|D]}||kr(||=q(q(W|S(u8
    Strip out user-configured sensitive event data. The fields to be stripped
    are configured in the main Salt Cloud configuration file, usually
    ``/etc/salt/cloud``.

    .. code-block: yaml

        cache_event_strip_fields:
          - password
          - priv_key

    .. versionadded:: 2014.7.0
    ucache_event_strip_fields(RlRmR+(RxRR)tstrip_fieldstfield((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyR%@s
cC@s�t|ttf�s-tdj|���nidd6dd6}|j|j|j!|kr~||j|j|j!|jfS|�dS(u~
    Helper method to try its best to convert any Unicode text into ASCII
    without stack tracing since salt internally does not handle Unicode strings

    This method is not supposed to be used directly. Once
    `py:module: salt.utils.cloud` is imported this method register's with
    python's codecs module for proper automatic conversion in case of encoding
    errors.
    uCan't handle {0}u u u-u–N(R�tUnicodeEncodeErrortUnicodeTranslateErrort	TypeErrorR-tobjectR�tend(R�t
unicode_trans((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt_salt_cloud_force_asciiWs

!usalt-cloud-force-asciicC@sFy ddl}|j||�SWntk
rAtjd�tSXdS(ua
    Retrieve particular user's password for a specified credential set from system keyring.
    iNuHUSE_KEYRING configured as a password, but no keyring module is installed(tkeyringtget_passwordR	RR�Ru(t
credential_idR�R4((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytretrieve_password_from_keyringus

cC@sIy#ddl}|j|||�SWntk
rDtjd�tSXdS(u3
    Saves provider password in system keyring
    iNuFTried to store password in keyring, but no keyring module is installed(R4tset_passwordR	RR�Ru(R6R�R�R4((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt_save_password_in_keyring�s

cC@s�y�ddl}ddl}|dkr{dj|�}ytj|�}Wntk
rbd}nX|s{td��q{nyt|||�Wn)|jj	k
r�}t
jd|�nXWntk
r�t
j
d�tSXdS(uS
    Interactively prompts user for a password and stores it in system keyring
    iNuPlease enter password for {0}: uInvalid password provided.u*Problem saving password in the keyring: %suFTried to store password in keyring, but no keyring module is installed(R4tkeyring.errorsRbR-tgetpasstEOFErrortRuntimeErrorR9terrorstPasswordSetErrorRRXR	R�Ru(R6R�R�R4tpromptR�((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytstore_password_in_keyring�s$



cC@s.|jd�}x|D]}||}qW|S(u�
    Accepts index in form of a string
    Returns final value
    Example: dictionary = {'a': {'b': {'c': 'foobar'}}}
             index_string = 'a,b,c'
             returns 'foobar'
    u,(R,(t
dictionarytindex_stringR�tk((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt_unwrap_dict�s
cC@s�d}x�||kr�||d|�}i}xf|D]^}t|t�r4|d}	t|	t�r�x*tj|	�D]\}
}|||
<qrWq�q4q4Wt||�}tjdtj	|�j
d�d||�tjd�q	Wt
S(u�
    Waits until the function retrieves some required argument.
    NOTE: Tested with ec2 describe_volumes and describe_snapshots only.
    R�iu+Function: %s, Watched arg: %s, Response: %su iiN(RbR�R�RRRPRERRXR R,R�R�Rd(R�R.tfun_calltargument_being_watchedtrequired_argument_responseR�tf_resulttr_settdtd0RDtv((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytrun_func_until_ret_arg�s 

#cC@s[tjjd||dtdt�}|tkrWtjjd||dddt�}n|S(uk
    Return the salt_interface type to connect to. Either 'public_ips' (default)
    or 'private_ips'.
    usalt_interfaceR^R_u
ssh_interfaceu
public_ips(RR`RaRu(R$Rt	salt_host((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytget_salt_interface�s			cC@sktjj|�s)tjd||�tStjtj|�j�}|dkrgtjd||�tSt	S(uL
    Checks that the key_path exists and the key_mode is either 0400 or 0600.

    Returns True or False.

    .. versionadded:: 2016.3.0

    provider
        The provider name that the key_path to check belongs to.

    key_path
        The key_path to ensure that it exists and to check adequate permissions
        against.
    uJThe key file '%s' used in the '%s' provider configuration does not exist.
ii�u`The key file '%s' used in the '%s' provider configuration needs to be set to mode 0400 or 0600.
(ii�(
R9R#RLRR�RuR|tS_IMODER~Rd(RWRTtkey_mode((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pytcheck_key_path_and_mode�s

c
C@sD|d
kr|Stjjd||dtdd
�}|tkrD|S|d
kr_|jd�n|}|d
kru|S|j�}|j|�tjj	|i�}|d}|d}tj
jd||||d|�}	t|	t
j�s<ydj|	j��}	Wq<tk
r8tjd	|	�t
j|	�}	q<Xn|	Sd
S(uL
    Use the configured templating engine to template the userdata file
    uuserdata_templateR_R^urenderer_blacklisturenderer_whitelistu:string:t
input_datauuKTemplated userdata resulted in non-string result (%s), converting to stringN(RbRR`RaRuR+RlRctloaderR!R&tcompile_templateR�RR�R<t	readlinesR"RR�R (
RR$tuserdatatuserdata_templatetrenderertrender_optstrendt	blacklistt	whitelistt	templated((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyRY
s>	


		
(�R�t
__future__RRRR�R9R|tcodecsRDR�RR�R@R�R�RQtloggingR�R�R�RlR�tsalt.utils.smbRRdtHAS_SMBR	Rutpypsexec.clientRR�t
pypsexec.scmrRR�tpypsexec.exceptionsRtsmbprotocol.treeRtsmbprotocol.exceptionsRt	getLoggertsetLeveltWARNINGR�R�twinrm.exceptionsRRt
salt.crypttsalt.clienttsalt.configtsalt.loadert
salt.templatetsalt.utils.compattsalt.utils.crypttsalt.utils.datatsalt.utils.eventtsalt.utils.filestsalt.utils.pathtsalt.utils.platformtsalt.utils.stringutilstsalt.utils.versionst
salt.utils.vttsalt.utils.yamltsalt.utils.nb_popenR	tsalt.utils.validate.pathR
t
salt.cloudtsalt.exceptionsRRR
RRRtsalt.extRtsalt.ext.six.movesRtjinja2RR�Rtplatformt
is_windowsR;tHAS_GETPASSR�tNSTATESR�tMR�R�R�RRbR'R*R5R7R?RCRWRYR]RhRpR8R�R�R�R�R0R�R�R�R�RRRRR�R�R�R}RR�R�ROR�R�R$RRTR�R�R�R�R�R�R�R�R�R�R�R�R�R�RRRR R!RRR%R3tregister_errorR7R9RARERNRPRSRY(((s4/usr/lib/python2.7/site-packages/salt/utils/cloud.pyt<module>s�








.






		,			
	
	.	
�"�K!0			;���;	!7Z
\	$		O	
		C	,#!%�			"	?							!

Zerion Mini Shell 1.0