+
    i"                         ^ RI t ^ RIt^ RIt^ RIHtHt ] P                  ! ]4      t ! R R]	4      t
 ! R R4      t ! R R4      t ! R	 R
]4      t ! R R]4      tR# )    N)subputilc                       ] tR t^tRtR# )CustomScriptNotFound N)__name__
__module____qualname____firstlineno____static_attributes__r       [/usr/lib/python3/dist-packages/cloudinit/sources/helpers/vmware/imc/config_custom_script.pyr   r      s    r   r   c                   ^    ] tR t^tRtRt]P                  P                  ]]4      t	Rt
RtRtR# )CustomScriptConstantz/root/.customizationzcustomize.shz)/.guest-customization-post-reboot-pendingzpost-customize-guest.shr   N)r   r	   r
   r   CUSTOM_TMP_DIRCUSTOM_SCRIPT_NAMEospathjoinCUSTOM_SCRIPTPOST_CUSTOM_PENDING_MARKERPOST_CUSTOM_SCRIPT_NAMEr   r   r   r   r   r      s0    +N (GGLL1CDM!L7r   r   c                   ,   a  ] tR t^ t o R tR tRtV tR# )RunCustomScriptc                f    Wn         W n        \        P                  P	                  W!4      V n        R # N)
scriptname	directoryr   r   r   
scriptpath)selfr   r   s   &&&r   __init__RunCustomScript.__init__!   s     $"'',,y=r   c                @   \         P                  P                  V P                  4      '       g   \	        R V P                  ,          4      h\
        P                  ! \        P                  4       \        P                  R\        P                  4       \
        P                  ! V P                  \        P                  4       \
        P                  ! \        P                  4      P                  RR4      p\
        P                  ! \        P                  VRR7       R# )z3Script %s not found!! Cannot execute custom script!zCopying custom script to %s id  )modeN)r   r   existsr   r   r   
ensure_dirr   r   LOGdebugr   copyload_text_filereplace
write_file)r    contents   & r   prepare_scriptRunCustomScript.prepare_script&   s    ww~~doo..&E//" 
 	,;;<		)+?+M+M	
 			$//#7#E#EF %% ..

'$
 	 	 ..e	
r   )r   r   r   N)r   r	   r
   r   r!   r0   r   __classdictcell____classdict__s   @r   r   r       s     >

 
r   r   c                   &   a  ] tR t^=t o R tRtV tR# )PreCustomScriptc                    \         P                  R4       V P                  4        \        P                  ! \        P
                  R.4       R# )z7Executing custom script with precustomization argument.z"Executing pre-customization scriptprecustomizationN)r)   r*   r0   r   r   r   )r    s   &r   executePreCustomScript.execute>   s4    		67		'557IJKr   r   N)r   r	   r
   r   r9   r   r2   r3   s   @r   r6   r6   =   s     L Lr   r6   c                   8   a a ] tR t^Et oV 3R ltR tRtVtV ;t# )PostCustomScriptc                   < \         \        V `  W4       W0n        \        P
                  P                  V\        P                  4      V n	        R # r   )
superr<   r!   ccScriptsDirr   r   r   r   r   ccScriptPath)r    r   r   r?   	__class__s   &&&&r   r!   PostCustomScript.__init__F   s:    .zE(GGLL.FF
r   c                F   V P                  4        \        P                  RV P                  4       \        P
                  ! \        P                  P                  V P                  \        P                  4      V P                  4       \        P                  ! V P                  4      p\        P                  ! V P                  VP                  \        P                  ,          4       \        P!                  R4       \        P"                  ! \        P$                  4       R# )z
This method copy the post customize run script to
cc_scripts_per_instance directory and let this
module to run post custom script.
z'Copying post customize run script to %sz*Creating post customization pending markerN)r0   r)   r*   r@   r   r+   r   r   r   r   r   r   statchmodst_modeS_IEXECinfoensure_filer   )r    sts   & r   r9   PostCustomScript.executeM   s     			;T=N=NO		GGLL 4 L L 		
 WWT&&'
""BJJ$=>=>-HHIr   )r@   r?   )	r   r	   r
   r   r!   r9   r   r2   __classcell__)rA   r4   s   @@r   r<   r<   E   s     
J Jr   r<   )loggingr   rD   	cloudinitr   r   	getLoggerr   r)   	Exceptionr   r   r   r6   r<   r   r   r   <module>rQ      s_     	   !	9 	8 8
 
:Lo LJ Jr   