+
    i4                       a  R@ t80 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
HtHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt ^ RIHt R	tRAtRBtRR
RR/tRt^tRtRt RRRRRRR]RRRRR] RR
RRRRR R!R"R/t!]"! R .4      t#]"! . RCO4      t$]"! . ]!PK                  4       O]#O]$OR#NR$NR%NR&NR'N4      t&R(t'R)t(RDt)]PT                  ! ]+4      t,R*R+R,R-.R.]R/R0./t-] ^ k R1 t.R2 t/R3 t0R4 R5 lt1R6 t2R7 R8 lt3RER9 R: llt4R; R< lt5R= R> lt6R? t7R# )Fz7Chef: module that configures, starts and installs chef.N)List)subp
temp_utils	templater
url_helperutilCloud)Config)
MetaSchemaDistro)
PER_ALWAYS1.8/var/chef/cache/var/chef/backupz/var/cache/chefz/var/backups/chefz#https://www.chef.io/chef/install.shz/etc/chef/validation.pemz/etc/chef/firstboot.jsonssl_verify_modez:verify_none	log_levelz:infolog_locationz/var/log/chef/client.logvalidation_keyvalidation_cert
client_keyz/etc/chef/client.pemjson_attribsfile_cache_pathfile_backup_pathpid_filez/var/run/chef/client.pid	show_timeTencrypted_data_bag_secret
server_url	node_nameenvironmentvalidation_namechef_licensez/etc/chef/client.rbz/usr/bin/chef-clientidcc_chefdistrosall	frequencyactivate_by_schema_keyschefc                     \         P                  ! V R RR7      pV'       dH   \        P                  P	                  \
        4      '       d   \        P                  ! \
        4       R# R# R# )delete_validation_post_execFdefaultN)r   get_cfg_option_boolospathisfileCHEF_VALIDATION_PEM_PATHunlink)chef_cfg
delete_pems   & :/usr/lib/python3/dist-packages/cloudinit/config/cc_chef.pypost_run_chefr7   g   sF    ))/J bggnn%=>>
		*+ ?z    c                    \         P                  4       pVP                  4        Fo  w  r4V\        9  d   \        P                  R V4       K(  Vf   RW#&   K2  V\        9   d   \        P                  ! W4      W#&   KW  \        P                  ! W4      W#&   Kq  	  VP                  R\        P                  ! 4       R\        P                  ! VRV R7      R\        P                  ! VRRR7      RVR,          RVR,          /4       V# )	z'Skipping unknown chef template key '%s'Ngenerated_byr   r,   r    _defaultr   r!   )CHEF_RB_TPL_DEFAULTScopyitemsCHEF_RB_TPL_KEYSLOGdebugCHEF_RB_TPL_BOOL_KEYSr   r.   get_cfg_option_strupdatemake_header)iidr4   paramskvs   &&   r6   get_template_paramsrJ   o   s    !&&(F  $$II?C9FI )) 44XA	 33H@	 ! MMD,,.00+s 422- (<0x(9:	
 Mr8   c            	        \         P                  4        EF*  w  r\        P                  P	                  V 4      '       g   K-  \        P
                  ! V 4       F  p\        P                  P	                  \        P                  P                  W4      4      '       d7   \        P                  R\        P                  P                  W4      V4       K{  \        P                  R\        P                  P                  W4      V4       \        P                  ! \        P                  P                  W4      V4       K  	  EK-  	  R# )zEMigrate legacy chef backup and cache directories to new config paths.z4Ignoring migration of %s. File already exists in %s.zMoving %s to %s.N)CHEF_DIR_MIGRATIONr>   r/   r0   existslistdirjoinr@   rA   shutilmove)old_dirmigrated_dirfilenames      r6   migrate_chef_config_dirsrU      s    !3!9!9!;77>>'""JJw/77>>"'',,|"FGGIINW7$
 		&GGLL3 
 BGGLL;\J 0 "<r8   c          
      L    V ^8  d   QhR\         R\        R\        R\        RR/# )   namecfgcloudargsreturnN)strr
   r	   list)formats   "r6   __annotate__r`      s6     U  U  U 6 U % U t U  U r8   c                   RV9  d   \         P                  RV 4       R# VR,          p\        P                  ! VR4      pV'       g   \	        \
        4      p\        P                  ! V\        4       F  p\        P                  ! V4       K  	  \        4        VP                  R\        4      pVP                  R4      pV'       dZ   VR8w  d   \        P                  ! Wx4       M;\        P                  P!                  V4      '       g   \         P#                  RV4       \        P$                  ! VR	\&        R
7      p	VP)                  R4      p
V
'       d   \+        VP,                  P/                  4       4      p\1        W4      p\3        4       pVP5                  4        FJ  w  rV\6        9   g   K  V'       g   K  VP9                  \        P                  P;                  V4      4       KL  	  \        P<                  ! V4       \>        P@                  ! WV4       M\         P#                  RV	4       \        P$                  ! VR\B        R
7      pV'       g   \         PE                  R4       M|/ pRV9   d   VR,          VR&   RV9   d6   VR,          p\	        VPG                  4       4       F  pVV,          VV&   K  	  \        P                  ! V\H        PJ                  ! V4      4       \        PL                  ! VRRR
7      p\N        PP                  ! \R        4      pV'       d	   V'       d   \U        W$4      pM$V'       d   \        PL                  ! VRRR
7      pMRpV'       d   \W        V4       \Y        V4       R# R# )z'Handler method activated by cloud-init.r)   z8Skipping module named %s, no 'chef' key in configurationNdirectoriesr   r   systemzWchef validation_cert provided as 'system', but validation_key path '%s' does not exist.config_pathr,   zchef_client.rbz&No template found, not rendering to %sfirstboot_pathz7First boot path empty, not writing first boot json filerun_listinitial_attributesforce_installFexec)-r@   rA   r   get_cfg_option_listr^   	CHEF_DIRS	itertoolschainREQUIRED_CHEF_DIRS
ensure_dirrU   getr2   
write_filer/   r0   r1   warningrC   CHEF_RB_PATHget_template_filenamer]   
datasourceget_instance_idrJ   setr>   CHEF_RB_TPL_PATH_KEYSadddirnameensure_dirsr   render_to_fileCHEF_FB_PATHinfokeysjsondumpsr.   r   is_exeCHEF_EXEC_PATHinstall_chefrun_chefr7   )rX   rY   rZ   r[   r4   	chef_dirsd	vkey_pathvcertcfg_filenametemplate_fnrF   rG   param_pathsrH   rI   fb_filenameinitial_jsonrg   rh   	installedruns   &&&&                  r6   handler      s    S		F	
 	6{H ((=AIO	__Y(:; < -/GHILL*+E HOOI-	**KK; **-L --.>?K%""2245$S3 eLLNDA))aa 23 # 	%  FC<lK ))"LK JK!'/
';L$8+!)*>!?,1134"4Q"7Q 5TZZ%=> ,,/5M N+I5+	&&xG
h r8   c                    \         P                  R 4       \        .pRV 9   d   V R,          p\        V\        \
        34      '       d   VP                  V4       Mr\        V\        4      '       d   VP                  V4       MJ\         P                  R\        V4      4       VP                  \        4       MVP                  \        4       \        P                  ! VRR7       R# )zRunning chef-clientexec_argumentszRUnknown type %s provided for chef 'exec_arguments' expected list, tuple, or stringFcaptureN)r@   rA   r   
isinstancer^   tupleextendr]   appendrr   typeCHEF_EXEC_DEF_ARGSr   )r4   cmdcmd_argss   &  r6   r   r      s    II#$
C8#,-hu..JJx #&&JJx KK X	 JJ)*

%&IIc5!r8   c                0    V ^8  d   QhR\         R\        /# )rW   distror[   )r   r^   )r_   s   "r6   r`   r`     s     . . .d .r8   c                   VP                  4       pVP                  RR4      p\        P                  ! VP	                  4       RR7      ;_uu_ 4       p\
        P                  P                  WT4      pVP                  ^ V4       \        P                  ! W`RR7       \        P                  ! R	RV/VB uuRRR4       #   + '       g   i     R# ; i)
zWrite blob to a tempfile, and call subp with args, kwargs. Then cleanup.

'basename' as a kwarg allows providing the basename for the file.
The 'args' argument to subp will be updated with the full path to the
filename as the first argument.
basename	subp_blobT)dir	needs_exei  )moder[   N )r=   popr   tempdirget_tmp_exec_pathr/   r0   rO   insertr   rq   r   )blobr   r[   kwargsr   tmpdtmpfs   &&&,   r6   subp_blob_in_tempfiler     s     99;Dzz*k2H			$$&$
 
	ww||D+At/yy-d-f-
 
 
 
s   A!B==C	c                $    V ^8  d   QhR\         /# )rW   r   r   )r_   s   "r6   r`   r`   '  s      r8   c                    Vf   \         pVf   \        pVf   . pMRV.p\        P                  ! WR7      P                  p\        V VVRRR7      # )aK  Install an omnibus unified package from url.

@param url: URL where blob of chef content may be downloaded. Defaults to
    OMNIBUS_URL.
@param retries: Number of retries to perform when attempting to read url.
    Defaults to OMNIBUS_URL_RETRIES
@param omnibus_version: Optional version string to require for omnibus
    install.
z-v)urlretrieszchef-omnibus-installF)r   r   r[   r   r   )OMNIBUS_URLOMNIBUS_URL_RETRIESr   readurlcontentsr   )r   r   r   omnibus_versionr[   contents   &&&&  r6   install_chef_from_omnibusr   '  s_     {%o&  S:CCG ' r8   c                $    V ^8  d   QhR\         /# )rW   rZ   r   )r_   s   "r6   r`   r`   F  s       r8   c                    \         P                  ! VR R4      p\         P                  ! VRRR7      pVR8X  df   \         P                  ! VRR4      p\         P                  ! VR\        4      p\	        WTV P
                  4       \         P                  ! VRR	R7      pV# VR8X  d   V P
                  P                  R
.4       V# VR8X  d]   \         P                  ! VR4      p\        V P
                  \         P                  ! VR4      \         P                  ! VR4      VR7       V# \        P                  RV4       RpV# )install_typepackagesri   Fr,   gemsversionNruby_versionTr)   omnibusr   omnibus_urlomnibus_url_retries)r   r   r   r   zUnknown chef install type '%s')r   rC   r.   RUBY_VERSION_DEFAULTinstall_chef_from_gemsr   install_packagesr   get_cfg_option_intr@   rr   )rZ   r4   r   r   chef_versionr   r   s   &&     r6   r   r   F  s'   **.*L 
"
"8VU
CCv..xDI..n&:
 	|5<<H &&xF J 
	#%%vh/ J 
	"11(<MN!<<''-@++H6KL+		
 J 	4lCJr8   c                :    V ^8  d   QhR\         \        ,          /# )rW   r\   )r   r]   )r_   s   "r6   r`   r`   g  s      $s) r8   c                 Z    R V ,          RV ,          .pV R8X  d   VP                  R4       V# )zruby%sz
ruby%s-devr   )zlibopenssl-ruby1.8zrubygems1.8)r   )r   pkgss   & r6   get_ruby_packagesr   g  s0    ')<'+ABD%9:Kr8   c                    VP                  \        V 4      4       \        P                  P	                  R 4      '       g   \
        P                  ! RV ,          R 4       \        P                  P	                  R4      '       g   \
        P                  ! RV ,          R4       V'       d+   \        P                  ! R RRRV,          RRR	R
R.	RR7       R# \        P                  ! . RORR7       R# )/usr/bin/gemz/usr/bin/gem%sz/usr/bin/rubyz/usr/bin/ruby%sinstallr)   z-v %s--no-ri	--no-rdoc--bindir/usr/bin-qFr   N)r   r   r)   r   r   r   r   r   )r   r   r/   r0   rM   r   sym_linkr   )r   r   r   s   &&&r6   r   r   o  s    
-l;<77>>.))&5~F77>>/**',6H		,&
 	
 				 	
r8   c                @    V ^8  d   Qh/ ^ \         9   d
   \        ;R&   # )rW   meta)__conditional_annotations__r   )r_   s   "r6   r`   r`   	   s      = =l j m >r8   )	/etc/chefz/var/log/chefz/var/lib/chefr   r   z/var/run/chef)r   )r   r   r   r   r   r   r   )z-dz-i1800z-s20)NNN)9r   __doc__rl   r   loggingr/   rP   typingr   	cloudinitr   r   r   r   r   cloudinit.cloudr	   cloudinit.configr
   cloudinit.config.schemar   cloudinit.distrosr   cloudinit.settingsr   r   rk   rn   rL   r   r   r2   r}   r<   	frozensetrB   rx   r   r?   rs   r   r   	getLogger__name__r@   r   r7   rJ   rU   r   r   r   r   r   r   r   r`   )r   s   @r6   <module>r      s   >    	   C C ! # . $ ) 	 $  (+  4 5 ) ~..t(L(**   ";-0 !
  			"	"	$			 
	 			
 		 		 		 		  %'5  ! 	)wx	 , FK(U p",.&>B"
r8   