+
    i                       a  R t"0 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ]t^tRR	R
].R]RR./t] ^ k ]P0                  ! ]4      tR tR tR R ltR tR tRR lt R t!R# )z&Power State Change: Change power stateN)subputil)Cloud)Config)
MetaSchema)ALL_DISTROS)PER_INSTANCEidcc_power_state_changedistros	frequencyactivate_by_schema_keyspower_statec                 r    \         P                  ! 4       '       dn   \        P                  ! R R\        V 4      .4      w  rVP	                  4       ^,          p\
        P                  ! RV4      pV'       d   VP                  ^4      # R# \         P                  ! RV ,          4      #   \         d     R# i ; i)procstatz-cz\d+ (\w|\.|-)+\s+(/\w.+)Nz/proc/%s/cmdline)
r   
is_FreeBSDr   str
splitlinesresearchgroupload_text_fileIOError)pidoutput_errlinems   &    H/usr/lib/python3/dist-packages/cloudinit/config/cc_power_state_change.pygivecmdliner   %   s     ??!YY
D#c('CDNV$$&q)D		5t<Awwqz!&&'9C'?@@ s   B' A*B' 
B' 'B65B6c                 
   \        V \        4      '       d   \        P                  R V 4       V # RV ,          p \        P
                  ! V \        V \        4      '       * R7      pVP                  4        VP                  pV^ 8X  d   \        P                  RV4       R# V^8X  d   \        P                  RV4       R# \        P                  RW4       R#   \         d"   p\        P                  RY4        R	p?R# R	p?ii ; i)
zStatic Condition: %szcheck_condition command (%s): )shellz%sexited 0. condition met.Tz%sexited 1. condition not met.Fz*%sunexpected exit %s. do not apply change.z%sUnexpected error: %sN)
isinstanceboolLOGdebug
subprocessPopenlistcommunicate
returncodewarning	Exception)condpreprocretes   &    r   check_conditionr2   :   s    $		($/
*T
1C
40F,FGoo!8II2C8AXII6<KKDcO ,c5s$   A$C C >C D!C==Dc          
      L    V ^8  d   QhR\         R\        R\        R\        RR/# )   namecfgcloudargsreturnN)r   r   r   r(   )formats   "r   __annotate__r;   R   s/     ! ! !6 !% !t ! !    c           
      b    \        WP                  4      w  rEpVf   \        P                  R4       R #  TRJ d   \        P                  R4       R # \        P                  ! 4       p\        T4      p	T	'       g   \        P                  R4       R # \        \        P                  R4      p
\        P                  RTRP                  T4      4       \        P                  ! \        TT	TT\         YJ.4       R #   \         d+   p\        P                  R\        T4      4        R p?R # R p?ii ; i)	Nz&no power_state provided. doing nothingz%%s Not performing power state change!Fz3Condition was false. Will not perform state change.z5power_state: failed to get cmdline of current processwz#After pid %s ends, will execute: %s )load_power_statedistror$   r%   r,   r+   r   osgetpidr   opendevnulljoinr   fork_cbrun_after_pid_goneexecmd)r5   r6   r7   r8   arg_listtimeout	conditionr1   mypidcmdline
devnull_fps   &&&&       r   handlerP   R   s    )9#||)L&III>?  E		GHIIKE% GKLbjj#&JII3UCHHX<NOLL	'  ;SVDs   1C9 9D.D))D.c                 ~   V P                  R 4      pVf   R# \        V\        4      '       g   \        R4      h. ROpVP                  R4      pWAP                  9  d$   \        RRP                  V4      : RV: R24      hVP                  VVP                  RR	4      VP                  R
4      R7      p \        VP                  RR4      4      pTP                  RR4      p\        T\        \        \        34      '       g   \        R4      hYVT3#   \         d    p\        RTR,          ,          4      ThRp?ii ; i)r   Nzpower_state is not a dict.modez,power_state[mode] required, must be one of: ,z
. found: 'z'.delaynowmessage)rR   rT   rV   rK   g      >@z(failed to convert timeout '%s' to float.rL   Tz2condition type %s invalid. must be list, bool, str)NNN)haltpoweroffreboot)getr"   dict	TypeErrorshutdown_options_maprF   shutdown_commandfloat
ValueErrorr   r(   r#   )	r6   rA   pstatemodes_okrR   r8   rK   r1   rL   s	   &&       r   r@   r@   v   s/    WW]#F~!!fd##455-H::fD...xx!4)
 	

 ""jj%(

9% # D

9d34 

;-Ii#tT!233LMM9%%  6	9JJ
	s   5D D<D77D<c                 2    \         P                  ! V 4       R # N)rB   _exit)sysexits   &r   doexitrg      s    HHWr<   c                    ^p \         P                  ! V \         P                  V\         P                  R7      pVP	                  V4       VP
                  p\        V4       R#   \         d    \        \        4        L)i ; i)   )stdinstdoutstderrN)	r&   r'   PIPESTDOUTr)   r*   r,   rg   	EXIT_FAIL)exe_argsr   data_inr0   r/   s   &&&  r   rI   rI      sm    
C
//$$	
 	!oo 3K  ys   AA$ $B Bc                    R p\         P                  ! 4       V,           pR p\        P                  \        P                  3p	 \         P                  ! 4       V8  d   RV ,          pM7 \        V 4      p
W8w  d   RV : RV
: R2pM \         P                  ! R	4       K\  V'       g	   V! R
4       \        P                  V4        \        V4      '       g   R #  V! V!   R #   \         d@   pTP                  T	9   d   RTP                  ,          pMT! RT,          4        R p?K  R p?i\         d   pT! RT,          4        R p?LR p?ii ; i  \         d   pT! RT,          4        R p?LR p?ii ; i)Nc                 N    \         P                  V 4       \        \        4       R # rd   )r$   r+   rg   ro   )msgs   &r   fatal!run_after_pid_gone.<locals>.fatal   s    Cyr<   ztimeout reached before %s endedzcmdline changed for z [now: ]zpidfile gone [%d]zIOError during wait: %szUnexpected Exception: %sg      ?z&Unexpected error in run_after_pid_gonez0Unexpected Exception when checking condition: %s)time	monotonicerrnoENOENTESRCHr   r   r,   sleepr$   r%   r2   )r   
pidcmdlinerK   rL   funcr8   rt   end_timeru   known_errnosrN   ioerrr1   s   &&&&&&       r   rH   rH      s;    C~~')H LL%++.L
>>h&3c9C	2!#&G$<?I % 	

467IIcNFy)) *
 	$K/  	{{l*)EKK7/%78 	2,q011	2  F@1DEEFsB   (C  E  E+4D%%E2E3EEE3E..E3c                @    V ^8  d   Qh/ ^ \         9   d
   \        ;R&   # )r4   meta)__conditional_annotations__r   )r:   s   "r   r;   r;      s     , ,( j ) -r<   )NN)#r   __doc__rz   loggingrB   r   r&   rx   	cloudinitr   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar   cloudinit.distrosr   cloudinit.settingsr   r   ro   r   	getLogger__name__r$   r   r2   rP   r@   rg   rI   rH   r;   )r   s   @r   <module>r      s    -   	 	     ! # . ) +		 	
!}	  !*0!H#&L /r<   