Viewing File: /usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/guestcust_util.pyc

ó
ƒjbc@s”ddlZddlZddlZddlZddlmZddlmZddlm	Z	ej
eƒZdZ
dZdZd	„Zdd
„Zd„Zd„Zd
„ZdS(iÿÿÿÿN(tutili(tGuestCustEventEnum(tGuestCustStateEnums/var/log/cloud-init.logtqueryNicsSupportedt	connectedcCs|s
dSd}d}yMtjd|ƒtjd|gddgƒ\}}|rb|jƒ}nWn-tk
r’}tjdƒtj|ƒnX||fS(NtsError sending the RPC commandsSending RPC command: %ssvmware-rpctooltrcsisFailed to send RPC command(tNonetloggertdebugRtsubptrstript	Exceptiont	exception(trpctoutterrte((sW/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/guestcust_util.pytsend_rpcs$
cCsRd}|rtd|}nt}d|||f}t|ƒ\}}||fS(NRt@sdeployPkg.update.state %d %d %s(tCLOUDINIT_LOG_FILER(t	custstatet	custerrorterrormessagetmessageRRR((sW/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/guestcust_util.pytset_customization_status2scCsQ|s
dSd}tjj|ƒs&dSt|dƒ}|j|ƒ}WdQX|S(s‹Reads the NICS from the specified file path and returns the content

    @param nicsfilepath: Absolute file path to the NICS.txt file.
    itrN(Rtostpathtexiststopentread(tnicsfilepatht	NICS_SIZEtfptnics((sW/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/guestcust_util.pytget_nics_to_enable?scCs*|stjdƒdSd}d}d}xêtd|ƒD]Ù}tjd|ƒttjtj|ƒ\}}|sŠt	j
||ƒq9n|tkr§tjdƒdSxhtd|ƒD]W}ttjtj|ƒ\}}|r|t
krtjd|ƒdSt	j
|ƒq·Wq9Wtjd|ƒdS(	Ns
No Nics foundiiis(Trying to connect interfaces, attempt %ds-NICS connection status query is not supportedsNICS are connected on %d seconds2Can't connect network interfaces after %d attempts(RtwarningtrangeR	RRtGUESTCUST_STATE_RUNNINGRtGUESTCUST_EVENT_ENABLE_NICSttimetsleeptQUERY_NICS_SUPPORTEDtGUESTCUST_EVENT_QUERY_NICStNICS_STATUS_CONNECTEDtinfo(R#tenableNicsWaitRetriestenableNicsWaitCounttenableNicsWaitSecondstattemptRt_errtcount((sW/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/guestcust_util.pytenable_nicsTs:

	c	Cstjdƒs tjdƒ|Sddd||g}ytj|ƒ\}}Wnhtjk
rž}|jdkr‘tjddj|ƒ|ƒn#tjd||jƒtj	|ƒ|SX|}t
jd	|ƒ}|r|jd
ƒj
ƒ}tjd|||ƒntjd|||ƒ|S(
s5 Return the value of [section] key from VMTools configuration.

        @param section: String of section to read from VMTools config
        @returns: String value from key in [section] or defaultVal if
                  [section] is not present or vmware-toolbox-cmd is
                  not installed.
    svmware-toolbox-cmds9vmware-toolbox-cmd not installed, returning default valuetconfigtgetiEsRvmware-toolbox-cmd returned 69 (unavailable) for cmd: %s. Return default value: %st sFailed running %s[%s]s([^=]+)=(.*)isGet tools config: [%s] %s = %ss<Tools config: [%s] %s is not found, return default value: %s(RtwhichRR	R
tProcessExecutionErrort	exit_codetjointerrorR
tretmatchtgrouptstrip(	tsectiontkeyt
defaultValtcmdtoutTextt_RtretValuetm((sW/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/guestcust_util.pytget_tools_configzs2	
	
(tloggingRR>R)t	cloudinitRtguestcust_eventRtguestcust_stateRt	getLoggert__name__RRR+R-RRRR$R5RJ(((sW/usr/lib/python2.7/site-packages/cloudinit/sources/helpers/vmware/imc/guestcust_util.pyt<module>s	
		&
Back to Directory File Manager