| Server IP : 3.138.164.131 / Your IP : 216.73.216.136 Web Server : Apache System : Linux ns1.techtime.me 4.18.0-147.8.1.el8.lve.1.x86_64 #1 SMP Mon Jun 29 09:55:57 EDT 2020 x86_64 User : injazaat ( 1471) PHP Version : 8.1.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /usr/lib/python3.6/site-packages/cloudinit/cmd/devel/__pycache__/ |
Upload File : |
3
��b� � @ s� d Z ddlZddlZddlZddlZddlmZ ddlmZ ddlm Z m
Z
ddlmZ ddl
mZmZmZmZ dd gZd
ZdZddd
�Zdd� Zdd� Zdd� Zdd� Zddd�Zdd� Zdd� Zedkr�eje� � dS )zGDefine 'collect-logs' utility and handler to include in cloud-init cmd.� N)�datetime)�INSTANCE_JSON_SENSITIVE_FILE)�ProcessExecutionError�subp)�tempdir)�chdir�copy�
ensure_dir�
write_filez/var/log/cloud-init.logz/var/log/cloud-init-output.logz/run/cloud-initz%/var/lib/cloud/instance/user-data.txtc C sZ | st jddd�} | jdddddd d
� | jddd
dd� | jddddddjt�d� | S )a2 Build or extend and arg parser for collect-logs utility.
@param parser: Optional existing ArgumentParser instance representing the
collect-logs subcommand which will be extended to support the args of
this utility.
@returns: ArgumentParser with proper argument configuration.
zcollect-logsz)Collect and tar all cloud-init debug info)�prog�descriptionz --verbosez-v�countr � verbosityzBe more verbose.)�action�default�dest�helpz --tarfilez-tzcloud-init.tar.gzzOThe tarfile to create containing all collected logs. Default: cloud-init.tar.gz)r r z--include-userdataz-uF�
store_true�userdatazPOptionally include user-data from {0} which could contain sensitive information.)r r r r )�argparse�ArgumentParser�add_argument�format�USER_DATA_FILE)�parser� r �/usr/lib/python3.6/logs.py�
get_parser s2
r c C s dg}t j� dkr|jt� |S )z>Return a list of files to ignore for /run/cloud-init directoryzhook-hotplug-cmdr )�os�getuid�appendr )�curdir�filesZ
ignored_filesr r r �_copytree_rundir_ignore_filesD s
r# c C st yt | �\}}W n@ tk
rP } z$t|t|�� td| d|� W Y dd}~X n X t||� td| d|� |S dS )zCHelper which runs a command and writes output or error to filename.zcollecting %s failed.
� Nz
collected %s
)r r r
�str�_debug)�cmd�filename�msgr �out�_�er r r �_write_command_output_to_fileO s "
r- c C s ||krt jj| � d S )N)�sys�stderr�write)r) �levelr r r r r&