+
    ˜qgjê  ã                   ó@  € 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 ^ RIHtHtHt ^ R	IHtHtHtHtHt ]P<                  ! ]4      t R
t!]RRRRR.t"R.t#R R lt$RR lt%RR lt&R t'R t(]R8X  d
   ](! 4        R# R# )zFDefine 'clean' utility and handler as part of cloud-init command line.N)ÚsettingsÚsources)Ú	cc_mounts)Úuses_systemd)Úlog_util)ÚCLOUDINIT_NETPLAN_FILE)ÚInit)ÚProcessExecutionErrorÚrunpartsÚsubp)Údel_dirÚdel_fileÚget_config_logfilesÚis_linkÚ
write_filez/etc/machine-idz-/etc/NetworkManager/conf.d/99-cloud-init.confz?/etc/NetworkManager/conf.d/30-cloud-init-ip6-addr-gen-mode.confz@/etc/NetworkManager/system-connections/cloud-init-*.nmconnectionz,/etc/systemd/network/10-cloud-init-*.networkz+/etc/network/interfaces.d/50-cloud-init.cfgz)/etc/ssh/sshd_config.d/50-cloud-init.confc                ó0   € V ^8„  d   QhR\         R\        /# )é   Úlog_fileÚreturn)ÚstrÚbool)Úformats   "Ú5/usr/lib/python3/dist-packages/cloudinit/cmd/clean.pyÚ__annotate__r   .   s   € ÷ ñ ¤Sð ¬Tñ ó    c                óö   €  \         P                  ! V 4      p\        P                  ! VP                  4      '       g'   \        P                  ! VP                  4      '       d   R#  R#   \
         d     R# i ; i)zÑCheck if a log file should be removed.

Avoid tracebacks from attempting to remove device files.

@param log_file: Path to the log file to check.
@returns: True if the file should be removed, False otherwise.
FT)ÚosÚstatÚS_ISBLKÚst_modeÚS_ISCHRÚOSError)r   Ú	file_stats   & r   Úshould_remove_log_filer#   .   s`   € ðÜ—G’G˜HÓ%ˆ	Ü�<Š<˜	×)Ñ)×*Ò*¬d¯lªl¸9×;LÑ;L×.MÒ.MÙð /Nñ øô ô Úðús   ‚;A) ¾%A) Á)A8Á7A8c           
     ó,  € V '       g   \         P                  ! RRR7      p V P                  RRRRRR	R
7       V P                  RRRRR7       V P                  RRRRRR7       V P                  RRRRRRR
7       V P                  RR. RO. RRRR7       V # )a  Build or extend an arg parser for clean utility.

@param parser: Optional existing ArgumentParser instance representing the
    clean subcommand which will be extended to support the args of
    this utility.

@returns: ArgumentParser with proper argument configuration.
ÚcleanzJRemove logs, configs and artifacts so cloud-init re-runs on a clean system)ÚprogÚdescriptionz-lz--logsÚ
store_trueFÚremove_logszRemove cloud-init logs.)ÚactionÚdefaultÚdestÚhelpz--machine-idz©Set /etc/machine-id to 'uninitialized\n' for golden image creation. On next boot, systemd generates a new machine-id. Remove /etc/machine-id on non-systemd environments.)r*   r+   r-   z-rz--rebootz;Reboot system after logs are cleaned so cloud-init re-runs.z-sz--seedÚremove_seedz5Remove cloud-init seed directory /var/lib/cloud/seed.z-cz	--configsÚ+Úremove_configzbRemove cloud-init generated config files of a certain type. Config types: all, ssh_config, network)Úchoicesr+   Únargsr,   r-   )ÚallÚ
ssh_configÚnetworkÚ
datasourceÚfstab)ÚargparseÚArgumentParserÚadd_argument©Úparsers   &r   Ú
get_parserr=   ?   sì   € ÷ Ü×(Ò(Øð$ô
ˆð ×ÑØØØØØØ&ð ô ð ×ÑØØØðCð ô 	ð ×ÑØØØØØJð ô ð ×ÑØØØØØØDð ô ð ×ÑØØò
ð ØØð2ð ô ð  €Mr   c           
     ó@  € V P                  4        V'       d;   \        V P                  4       F!  p\        V4      '       g   K  \	        V4       K#  	  V'       dX   \        V4      P                  RR.4      '       d6   \         F+  p\        P                  ! V4       F  p\	        V4       K  	  K-  	  V'       d;   \        V4      P                  RR.4      '       d   \         F  p\	        V4       K  	  V'       d8   \        V4      P                  RR.4      '       d   \        P                  ! 4        T;'       d    \        V4      P                  RR.4      p\        P                  P                  V P                  P                   4      '       g.   \"        P$                  ! R\&        \(        P*                  R7       ^ # V'       d     V P-                  4       P/                  4        \        P                  P5                  V P                  P                   R	4      p\        P                  ! R
V P                  P                   ,          4       Fb  pWX8X  d   V'       g   K   \        P                  P                  V4      '       d   \7        V4      '       g   \9        V4       KW  \	        V4       Kd  	   \C        \D        PF                  4       ^ #   \0        P2                   d0    \"        P$                  ! R\&        \(        P*                  R7        EL*i ; i  \:         d<   p	\"        P<                  ! RP?                  T\A        T	4      4      4        Rp	?	 ^# Rp	?	ii ; i  \H         d6   p	\"        P<                  ! R\D        PF                   RT	 24        Rp	?	^# Rp	?	ii ; i)a¥  Helper which removes artifacts dir and optionally log files.

@param: init: Init object to use
@param: remove_logs: Boolean. Set True to delete the cloud_dir path. False
    preserves them.
@param: remove_seed: Boolean. Set True to also delete seed subdir in
    paths.cloud_dir.
@param: remove_config: List of strings.
    Can be any of: all, network, ssh_config, datasource, fstab.
@returns: 0 on success, 1 otherwise.
r3   r5   r4   r7   r6   zArtifacts already cleaned.)ÚlogÚ	log_levelz%No datasource found, nothing cleaned.Úseedz%s/*zCould not remove {0}: {1}NzFailure during run-parts of z: )%Úread_cfgr   Úcfgr#   r   ÚsetÚintersectionÚGEN_NET_CONFIG_FILESÚglobÚGEN_SSH_CONFIG_FILESr   Úcleanup_fstabr   ÚpathÚisdirÚpathsÚ	cloud_dirr   Ú	multi_logÚLOGÚloggingÚINFOÚfetchr%   r   ÚDataSourceNotFoundExceptionÚjoinr   r   r!   Úerrorr   r   r
   r   ÚCLEAN_RUNPARTS_DIRÚ	Exception)
Úinitr)   r.   r0   r   rJ   ÚconfÚclean_datasourceÚ	seed_pathÚes
   &&&&      r   Úremove_artifactsr]   „   s�  € ð 	‡M�M„OßÜ+¨D¯H©HÖ5ˆHÜ% h×/Ô/Ü˜Ö"ñ 6÷ œ˜]Ó+×8Ñ8¸%ÀÐ9K×LÒLß(ˆDÜŸ	š	 $ž�Ü˜–ó (ñ )÷ œ˜]Ó+×8Ñ8Ø	�Ð÷ò ÷ )ˆDÜ�TŽNñ )çœ˜]Ó+×8Ñ8¸%ÀÐ9I×JÒJÜ×ÒÔ!à$÷ ð ¬¨]Ó);×)HÑ)HØ	�Ðó*Ðô �7‰7�=‰=˜Ÿ™×-Ñ-×.Ò.Ü×ÒØ(ÜÜ—l‘lõ	
ñ
 çð	Ø�J‰J‹L×ÑÔ ô —‘—‘˜TŸZ™Z×1Ñ1°6Ó:€IÜ—	’	˜& 4§:¡:×#7Ñ#7Õ7Ö8ˆØÔ§[Ùð	Ü�w‰w�}‰}˜T×"Ò"¬7°4¯=ª=Ü˜–ä˜–ñ 9ðÜ”×,Ñ,Ô-ñ øô5 ×2Ñ2ô 	Ü×ÒØ7ÜÜ!Ÿ,™,÷ð ð	ûô  ô 	Ü�NŠNÐ6×=Ñ=¸dÄCÈÃFÓKÔLÞûð	ûô
 ô Ü�ŠØ*¬8×+FÑ+FÐ*GÀrÈ!ÈÐMô	
õ ûð	úsO   ÇK É$LÊLÊ"LÊ2M ËA LÌLÌMÌ/MÍMÍNÍ(*NÎNc           	     ó  € \        . R7      p\        W!P                  VP                  VP                  4      pVP
                  '       d3   \        4       '       d   \        \        RRR7       M\        \        4       V^ 8X  dA   VP                  '       d/   VP                  P                  RRRR7      p \        VR	R
7       V# V#   \         d=   p\        P                   ! RP#                  T\%        T4      4      4       ^p Rp?T# Rp?ii ; i)z3Handle calls to 'cloud-init clean' as a subcommand.)Úds_depszuninitialized
i$  )ÚmodeÚrebootÚnowN)r`   ÚdelayÚmessageF)Úcapturez-Could not reboot this system using "{0}": {1})r   r]   r)   r.   r0   Ú
machine_idr   r   ÚETC_MACHINE_IDr   ra   ÚdistroÚshutdown_commandr   r	   r   rU   r   r   )ÚnameÚargsrX   Ú	exit_codeÚcmdr\   s   &&    r   Úhandle_clean_argsrn   Í   så   € ä˜Ô€DÜ Ø×Ñ × 0Ñ 0°$×2DÑ2Dó€Ið ‡‡€Ü�>Š>ä”~Ð'8¸uÖEô ”^Ô$Ø�A„~˜$Ÿ+Ÿ+˜+Ø�k‰k×*Ñ*Ø °ð +ó 
ˆð	Ü�˜eÕ$ð Ðˆ9Ðøô %ô 	Ü�NŠNØ?×FÑFØœ˜Q›óôð
 ŒIØÐûð	ús   Â4C ÃDÃ1DÄDc                 óv   € \        4       p \        P                  ! \        RV P	                  4       4      4       R# )z4Tool to collect and tar all cloud-init related logs.r%   N)r=   ÚsysÚexitrn   Ú
parse_argsr;   s    r   Úmainrs   ê   s&   € ä‹\€FÜ‡H‚HÔ˜w¨×(9Ñ(9Ó(;Ó<Ö=r   Ú__main__)N)FN))Ú__doc__r8   rG   rP   r   r   rp   Ú	cloudinitr   r   Úcloudinit.configr   Úcloudinit.distrosr   Úcloudinit.logr   Úcloudinit.net.netplanr   Úcloudinit.stagesr   Úcloudinit.subpr	   r
   r   Úcloudinit.utilr   r   r   r   r   Ú	getLoggerÚ__name__rO   rg   rF   rH   r#   r=   r]   rn   rs   © r   r   Ú<module>r�      s®   ðñ Mã Û Û Û 	Û Û 
ç 'Ý &Ý *Ý "Ý 8Ý !ß @Ñ @÷õ ð ×Ò˜Ó!€Ø"€àØ3ØEØFØ2Ø1ðÐ ð 0ðÐ õ
ô"BôJFòRò:>ð ˆzÔÙ†Fñ r   