| Server IP : 3.7.136.76 / Your IP : 216.73.216.142 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-39-148 7.0.0-1010-aws #10~24.04.1-Ubuntu SMP PREEMPT Mon Jul 27 17:41:33 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /snap/core22/current/lib/python3/dist-packages/cloudinit/cmd/__pycache__/ |
Upload File : |
o
��i� � @ s d Z ddlZddlZddlZddlZddlZddlZddlmZm Z ddl
mZ ddlm
Z
ddlmZ ddlmZ ddlmZ dd lmZmZmZ dd
lmZmZmZmZmZ e�e�Z dZ!edd
dddgZ"dgZ#de$de%fdd�Z&d dd�Z'd!dd�Z(dd� Z)dd� Z*edkr�e*� dS dS )"zFDefine 'clean' utility and handler as part of cloud-init command line.� N)�settings�sources)� cc_mounts)�uses_systemd)�log_util)�CLOUDINIT_NETPLAN_FILE)�Init)�ProcessExecutionError�runparts�subp)�del_dir�del_file�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.conf�log_file�returnc C sD zt �| �}t�|j�st�|j�rW dS W dS ty! Y dS w )z�Check if a log file should be removed.
Avoid tracebacks from attempting to remove device files.
@param log_file: Path to the log file to check.
@returns: True if the file should be removed, False otherwise.
FT)�os�stat�S_ISBLK�st_mode�S_ISCHR�OSError)r � file_stat� r �5/usr/lib/python3/dist-packages/cloudinit/cmd/clean.py�should_remove_log_file. s
���r c C s� | s t jddd�} | jdddddd d
� | jddddd
� | jdddddd
� | jddddddd
� | jddg d�g dddd� | 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\n' for golden image creation. On next boot, systemd generates a new machine-id. Remove /etc/machine-id on non-systemd environments.)r"