ó ^Xc@sŠddlZddlZddlmZddlmZeZdZdada dZ dZ d Z d „Z d „Zd „Zd „ZdS(iÿÿÿÿN(t PER_INSTANCE(tutiltpidofs/usr/sbin/rsct/bin/rmcctrls"/usr/sbin/rsct/install/bin/recfgcts /sbin/srcmstrs/etc/ct_node_idic Csættg}xñ|D]é}|jdj|ƒƒtjj|ƒs|jdj||jddƒƒƒ|jddƒ}|jdj|ƒƒ|jdƒddkr°|an|jdƒddkrÒ|antjj|ƒsü|jd |ƒdSqqW|jd ƒt j ƒ}t |ƒ}|jd |ƒyt j td gƒWnt j |d ƒ‚nXd|djƒkrt|ƒnt|ƒt |ƒ} |jd| ƒ| |krâd} |j| ƒt| ƒ‚ndS(Ns tool is {}s%{} is not found, therefore trying {}.s /usr/sbins/optt/iÿÿÿÿtrmcctrltrecfgctsG%s is not found but is required, therefore not attempting to reset RMC.sAttempting to reset RMC.s"Node ID at beginning of module: %ss-zs!Failed to stop the RMC subsystem.tlinuxtplatformsNode ID at end of module: %ss"New node ID did not get generated.(tRMCCTRLtRECFGCTtdebugtformattostpathtisfiletreplacetsplitRt system_infot get_node_idtsubptlogexctlowertrecycle_srcmstr_processtreconfigure_rsct_subsystemsterrort Exception( tnamet_cfgt_cloudtlogt_argstrequired_toolsttoolRtnode_id_beforet node_id_aftertmsg((sJ/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_reset_rmc.pythandle$sD               cCs[y-tjtgƒd}|j|jƒƒWn'tjk rVtj|dƒ‚nXdS(Nis*Failed to reconfigure the RSCT subsystems.(RRR R tstriptProcessExecutionErrorR(Rtout((sJ/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_reset_rmc.pyRSs cCs\y*tjddtgƒdjƒ}|SWn+tjk rWtj|dtƒ‚nXdS(Ns /usr/bin/heads-n1is#Failed to get node ID from file %s.(RRt NODE_ID_FILER%R&R(Rtnode_id((sJ/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_reset_rmc.pyR_s "cCsWytjttgƒd}Wn'tjk rFtj|dƒ‚nXt|ƒ}|jd|ƒytj |dƒWntj|dƒ‚nXt j ƒ}x¯t rRt j dƒt j ƒ|t kródt }|j|ƒt|ƒ‚ny5ttjttgƒdƒ}|jd|ƒPWq¤tjk rN|jd ƒq¤q¤Xq¤WdS( Nis%Failed to get PID of srcmstr process.s)Recycling srcmstr process with PID of %d.i s#Failed to kill the srcmstr process.gà?s9srcmstr process failed to come back up within %d seconds.s,srcmstr process came back up with PID of %d.s4Still waiting for srcmstr process to come back up...(RRtPIDOFtSRCMSTRR&RtintR R tkillttimetTruetsleeptSRCMSTR_TIMEOUT_SECONDSRR(RR'tsrcmstr_pid_beforet start_timeR#tnew_srcmstr_pid((sJ/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_reset_rmc.pyRhs:        (R R.tcloudinit.settingsRt cloudinitRt frequencyR*RR R+R(R1R$RRR(((sJ/opt/freeware/lib/python2.7/site-packages/cloudinit/config/cc_reset_rmc.pyts   /