Sindbad~EG File Manager
3
�f6O � @ s� d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ d dlmZ d dl m Z d dl
mZ d dlm
Z
d dlmZ d dlmZ d d lmZ d d
lmZmZ G dd� d�ZG d
d� d�ZdS )� N)�SUPPRESS)�datetime)�getpass)�rmtree)�Path)�__version__)�TarFileArchive)�
SoSOptions)�TempFileUtil� shell_outc
@ s� e Zd ZdZdZi ZdZdZdZdZ dddddddddd dd
d�Z
dd
dddgZdd� Zdd� Z
dd� Zdd� Zd7dd�Zdd� Zdd� Zedd � �Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zd)d*� Zd8d+d,�Zd-d.� Zd/d0� Zd1d2� Zd3d4� Zd5d6� ZdS )9�SoSComponenta� Any sub-command that sos supports needs to subclass SoSComponent in
order to be properly supported by the sos binary.
This class contains the standardized entrypoint for subcommands, as well as
building out supported options from both globally shared option lists, and
options supported by that specific subcommand.
When sos initializes, it will load an unintialized instance of each class
found within one recursion of the module root directory that subclasses
SoSComponent.
If sos is able to match the user-specified subcommand to one that exists
locally, then that SoSComponent is initialized, logging is setup, and a
policy is loaded. From there, the component's execute() method takes over.
Added in 4.0
ZunsetTF�autoz/etc/sos/sos.confN� � r )�batch�compression_type�config_file�debug�encrypt�encrypt_key�encrypt_pass�quiet�threads�tmp_dir�sysroot� verbosityzsos_logs/sos.logzsos_reports/manifest.jsonzsos_commands/process/ps_*zsos_commands/selinux/ps_*z+sos_commands/systemd/systemctl_status_--allc C s� || _ || _|| _d| _d | _d | _d | _d | _ydd l}|j|j | j
� � W n tk
rb Y nX t| j
d�| _| jr�| j� | j
j| j� | j� | _| j�r | j� }t� | _tjj|� s�tj|tj� r�d| }|d7 }tjj|� | jd� || _ t!j"d| j d�| _t#| j�| _| j$� | jd k �r�| jj%d t&� | jj%d
dj'| j�� | jj%dt(j)� � | jj%d
d� | jj%dd� | jj%dd� | jj%d| j� | jj%d| j*� | jj%d| j+j,� | jj-d� d S )NFr )�arg_defaultsztemporary directory %s z"does not exist or is not writable
� zsos.)�prefix�dir�version�cmdline� Z
start_timeZend_timer Zrun_timeZcompression�tmpdirZtmpdir_fs_type�policyZ
components).�parser�argsr! �exit_process�archiver# �
tempfile_util�manifest�signal�SIGTERM�get_exit_handler� Exceptionr �
_arg_defaults�opts�load_policy�load_local_policy�updater �load_options�configure_logging�get_tmpdir_default�SoSMetadata�os�path�isdir�access�W_OK�sys�stderr�write�_exitZsys_tmp�tempfileZmkdtempr
�_setup_logging� add_fieldr �joinr Znow� tmpfstyper$ Zdistro�add_section)�selfr% Zparsed_argsZcmdline_argsr+ r# �msg� rI �/usr/lib/python3.6/component.py�__init__Q sT
zSoSComponent.__init__c C s^ y.dd l }|jj| jj| jd�| _| jj| _W n tk
rL | jd� Y nX | jj � | _
d S )Nr )r Z
probe_runtime)Zsos.policiesZpolicies�loadr0 r �
load_prober$ �KeyboardInterruptr@ Zis_rootZ_is_root)rG �sosrI rI rJ r2 � s zSoSComponent.load_local_policyc C s t �d S )N)�NotImplementedError)rG rI rI rJ �execute� s zSoSComponent.executec s � fdd�}|S )Nc s d� _ � j� d S )NT)r'