Server IP : 23.254.227.96 / Your IP : 216.73.216.46 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 : |
3 ��b� � @ s� d Z ddlZddlZddlZddlZddlmZ ddlmZm Z ddl mZmZm Z mZmZ ddd�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_linkc C sV | st jddd�} | jdddddd d � | jddddd 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.)r r r z-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_parser s2 r Fc C s� t g d�}|j� | r2xt|j�D ]}t|� q"W tjj|jj �sFdS tjj |jj d�}x�tjd|jj �D ]v}||kr�| r�qly,tjj|�r�t|� r�t |� nt|� W ql tk r� } ztdj|t|��� dS d}~X qlX qlW dS )a4 Helper 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_depsr Zseedz%s/*zCould not remove {0}: {1}� N)r Zread_cfgr Zcfgr �os�path�isdir�pathsZ cloud_dir�join�globr r �OSErrorr �format�str)r r ZinitZlog_fileZ seed_pathr �er r r �remove_artifactsB s&