Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/cloudinit/cmd/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/cloudinit/cmd/__pycache__/clean.cpython-310.pyc
o

}��fU�@s�dZddlZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZmZmZddlmZmZmZmZmZmZd	Ze
d
ddd
dgZdgZddd�Zddd�Zdd�Zdd�Zedkrle�dSdS)zFDefine 'clean' utility and handler as part of cloud-init command line.�N)�settings)�uses_systemd)�CLOUDINIT_NETPLAN_FILE)�Init)�ProcessExecutionError�runparts�subp)�del_dir�del_file�error�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	Cs�|s	tjddd�}|jdddddd	d
�|jddddd
�|jdddddd
�|jddddddd
�|jddgd�gdddd�|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.
    �cleanzJRemove logs, configs 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--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.z-cz	--configs)�all�
ssh_config�network�+�
remove_configzbRemove cloud-init generated config files of a certain type. Config types: all, ssh_config, network)�choicesr�nargsrr)�argparse�ArgumentParser�add_argument��parser�r%�5/usr/lib/python3/dist-packages/cloudinit/cmd/clean.py�
get_parser*sX	���
���r'Fc	Cs�|��|rt|j�D]}t|�q|r.t|��ddg�r.tD]}t�|�D]}t|�q&q|rBt|��ddg�rBtD]}t|�q;t	j
�|jj
�sLdSt	j
�|jj
d�}t�d|jj
�D]<}||krg|sgq^zt	j
�|�rwt|�swt|�nt|�Wq^ty�}ztd�|t|���WYd}~d	Sd}~wwzttj�WdSty�}ztd
tj�d|���WYd}~d	Sd}~ww)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.
    @returns: 0 on success, 1 otherwise.
    rrrr�seedz%s/*zCould not remove {0}: {1}N�zFailure during run-parts of z: )�read_cfgr�cfgr
�set�intersection�GEN_NET_CONFIG_FILES�glob�GEN_SSH_CONFIG_FILES�os�path�isdir�paths�	cloud_dir�joinr
r	�OSErrorr�format�strrr�CLEAN_RUNPARTS_DIR�	Exception)	�initrrr�log_filer2�conf�	seed_path�er%r%r&�remove_artifactsmsP

��

�������rAc
Cs�tgd�}t||j|j|j�}|jr!t�rttddd�nt	t�|dkrZ|j
rZ|jjdddd	�}z	t
|d
d�W|StyY}ztd�|t|���d
}WYd}~|Sd}~ww|S)z3Handle calls to 'cloud-init clean' as a subcommand.)�ds_depszuninitialized
i$)�moder�reboot�nowN)rC�delay�messageF)�capturez-Could not reboot this system using "{0}": {1}r))rrArrr�
machine_idrr�ETC_MACHINE_IDr
rD�distro�shutdown_commandrrrr8r9)�name�argsr<�	exit_code�cmdr@r%r%r&�handle_clean_args�s4
�������rQcCst�}t�td|����dS)z4Tool to collect and tar all cloud-init related logs.rN)r'�sys�exitrQ�
parse_argsr#r%r%r&�main�srU�__main__)N)FN) �__doc__r r/r1rR�	cloudinitr�cloudinit.distrosr�cloudinit.net.netplanr�cloudinit.stagesr�cloudinit.subprrr�cloudinit.utilr	r
rrr
rrJr.r0r'rArQrU�__name__r%r%r%r&�<module>s8 	�	�

C2
�

Spamworldpro Mini