%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.9/site-packages/sos/report/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.9/site-packages/sos/report/__pycache__/__init__.cpython-39.pyc

a

K�h�=�@sVddlZddlZddlZddlZddlZddlZddlZddlmZddlZddl	m
Z
ddl	mZddl
mZddlZddlmZmZmZmZmZmZmZmZddlmZddlmZdd	lmZddlZdd
l m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*ddl+m,Z,ddl-m.Z.ej/ej0fZ1ddd�Z2dd�Z3gd�Z4hd�Z5Gdd�de�Z6dS)�N)�datetime)�ThreadPoolExecutor)�TimeoutError)�rmtree)�ImporterHelper�SoSTimeoutError�bold�sos_get_command_output�TIMEOUT_DEFAULT�listdir�
is_executable�scrub_url_credential)�_sos)�__version__)�SoSComponent)
�Report�Section�Command�
CopiedFile�CreatedFile�Alert�Note�PlainTextReport�
JSONReport�
HTMLReport)�
SoSCleaner)�	SoSUploadF�, cCs�g}|}|rt|�d}nd}|D]:}t|�t|�t|�dkrP|�|�|}|||}q"|t|�d�|kr�|dt|��}|�|�|S)N� ��H)�len�append)Z
first_line�items�indent�sep�lines�line�newline�item�r*�7/usr/lib/python3.9/site-packages/sos/report/__init__.py�_format_list.s

r,cCst�|d�d�S)z� This function will format --since arg to append 0s if enduser
    didn't. It's used in the _get_parser.
    This will also be a good place to add human readable and relative
    date parsing (like '2 days ago') in the future z<014sz%Y%m%d%H%M%S)r�strptime)�dater*r*r+�
_format_since@sr/)�auto�always�never>Z
HTTP_PROXYZHTTPS_PROXYZNO_PROXYZhttps_proxyZ
http_proxyZ	ALL_PROXYc?s�eZdZdZdZdZdddddddddgggdddgdgdgddddd	dd
gggddddddgdeegdddgdddddddddddddddddd�>Z�fdd
�Ze	dd��Z
e	dd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd�d$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zed6d7��Zd�d8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@dA�Z$dBdC�Z%dDdE�Z&d�dGdH�Z'dIdJ�Z(dKdL�Z)dMdN�Z*dOdP�Z+dQdR�Z,dSdT�Z-dUdV�Z.dWdX�Z/dYdZ�Z0d[d\�Z1d]d^�Z2d�d_d`�Z3dadb�Z4dcdd�Z5dedf�Z6dgdh�Z7didj�Z8dkdl�Z9dmdn�Z:dodp�Z;dqdr�Z<dsdt�Z=dudv�Z>dwdx�Z?dydz�Z@d{d|�ZAd}d~�ZBdd��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZH�ZIS)��	SoSReportzaRun a set of commands and file collections and save them to a report for
    future analysis
    z.Collect files and command output in an archiveTFrr0�dN�� /etc/sos/cleaner/default_mapping)>�
alloptions�all_logs�build�case_id�chroot�clean�container_runtime�keep_binary_files�desc�domains�disable_parsers�skip_cleaning_files�dry_run�
estimate_only�experimental�enable_plugins�journal_size�keywords�keyword_file�plugopts�label�list_plugins�list_presets�
list_profiles�log_sizeZlow_priority�map_file�
skip_commands�
skip_files�skip_plugins�
namespaces�	no_report�no_env_vars�no_postproc�	no_update�note�only_plugins�preset�plugin_timeout�cmd_timeout�profiles�since�verify�allow_system_changes�	usernames�upload�
upload_urlZupload_directoryZupload_userZupload_passZ
upload_methodZupload_no_ssl_verifyZupload_protocol�upload_s3_endpointZupload_s3_regionZupload_s3_bucketZupload_s3_access_keyZupload_s3_secret_keyZupload_s3_object_prefixZ
upload_target�
add_preset�
del_presetcst��|||�g|_g|_g|_t|_||_d|_i|_	|�
�|��|j�
�|_|jj�d�|_|��d}|jj|_|jjr�d}n|j��r�|jtjkr�d}|j�d|j�d|�d��|jjtvr�|j�d	|jj���t��|j� �|�!d
�|�"�|�#�|�$�dS)N�/�report�default�cmdline�policyzset sysroot to 'z' (�)zinvalid chroot mode: �)%�super�__init__�loaded_plugins�skipped_plugins�all_options�default_env_vars�env_vars�_args�sysroot�estimated_plugsizes�print_header�
_set_debugrlZis_rootZ_is_root�manifest�
components�add_section�	report_md�_set_directories�optsZin_container�osr%�soslog�debugr;�chroot_modes�error�logging�shutdown�
tempfile_utilr<�_exit�_check_container_runtime�_get_namespaces�_get_hardware_devices)�self�parser�argsrk�msg��	__class__r*r+rp�s8


zSoSReport.__init__c
Cs�|�dd�}|jddddddd	�|jd
ddddd	�|jd
dddtdd�|jdddddd	�|jddddd�|jddddddd	�|jdddd �|jd!d"tdd#d$d%�|jd&dd'd(�|jd)dd*d(�|jd+dd,dd-d	�|jd.d/d0d1td2gd3�|jd4td5d6d7d8�|jd9d:d;d0d<td=gd3�|jd>d?dd@dAd�|jdBdCddDddEd	�|jdFddGd(�|jdHddIddJd	�|jdKddLtdMdNdO�|jdPdddQdR�|jdSddTd �|jdUdVd0dWtdXgd3�|jdYddZdd[d	�|jd\dd]dd^d	�|jd_dd`ddadb�|jdctdd#ddd%�|jdedfd0dgtdhgd3�|jdidtdjddk�|jdlddmd �|jdnddod �|jdpdqdrd0dstgdtdO�|jdugd0dvdwdx�|jdygd0dzd{dx�|jd|dd}dd~d	�|jddd�dd�d	�|jd�ddd�dR�|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�dgd��d�d��|jd�ddd�d��|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�dgd��d�d��|��}|jd�tdd�d��|jd�tdd�d��|�d�d��}|jd�d�d�d�ddd�d��|jd�d�gd0d�d��|jd�d0gd�d�d��|jd�d�d0gd�d�d��|jd�d0gd�d�d��|jd�dd�d�d��|jd�ddd�d�d��|jd�d�d�d�dȍ|jd�ddd�d�dx�|jd�d�gd0d�d��dS)�NzReport Optionsz.These options control how report collects dataz-az--alloptions�
store_truer7Fz%enable all options for loaded plugins)�action�destrj�helpz
--all-logsr8z-collect all available logs regardless of sizez--since�storer_zbEscapes archived files older than date. This will also affect --all-logs. Format: YYYYMMDD[HHMMSS])r�r�rj�typer�z--buildr9z;preserve the temporary directory and do not package resultsz	--case-idr:zspecify case identifier)r�r�r�z-cz--chrootr;r0zHchroot executed commands to SYSROOT [auto, always, never] (default=auto)z--container-runtimezLDefault container runtime to use for collections. 'auto' for policy control.)rjr�z--descz
--descriptionrzDescription for a new preset)r�r�rjr�z	--dry-runz#Run plugins but do not collect data)r�r�z--estimate-onlyzzApproximate disk space requirements for a real sos run; disables --clean and --collect, sets --threads=1 and --no-postprocz--experimentalrEzenable experimental pluginsz-ez--enable-plugins�extendrFzenable these plugins)r�r�r�r�rjz--journal-sizer4rGz+limit the size of collected journals in MiB)r�rjr�r�z-kz--plugin-optionz
--plugoptsrJz7plugin options in plugname.option=value format (see -l)z--labelz--namerKz"specify an additional report labelz-lz--list-pluginsrLz)list plugins and available plugin optionsz--list-presetsz#display a list of available presetsz--list-profilesrNzBdisplay a list of available profiles and plugins that they includez
--log-sizerOr5z6limit the size of collected logs (not journals) in MiB)r�r�r�rjr�z--low-priorityz(generate report with low system priority)r�rjr�z--namespaceszDlimit number of namespaces to collect output for - 0 means unlimitedz-nz--skip-pluginsrSzdisable these pluginsz--no-reportrUz disable plaintext/HTML reportingz
--no-env-varsrVz$Do not collect environment variablesz
--no-postprocrWzDisable all post-processing)rjr�r�r�z--notezBehaviour notes for new presetz-oz--only-pluginsrZzenable these plugins onlyz--presetzA preset identifier)r�r�r�rjz--plugin-timeoutzset a timeout for all pluginsz
--cmd-timeoutz%set a command timeout for all pluginsz-pz	--profilez
--profilesr^z)enable plugins used by the given profilesz--skip-commandsrQzdo not execute these commands)rjr�r�r�z--skip-filesrRzdo not collect these filesz--verifyr`z+perform data verification during collectionz--allow-system-changesrazJRun commands even if they can change the system (e.g. load kernel modules)z--uploadz+Upload archive to a policy-default locationz--upload-urlz&Upload the archive to specified serverz--upload-directoryz$Specify upload directory for archivez
--upload-userz'Username to authenticate to server withz
--upload-passz'Password to authenticate to server withz--upload-method)r0ZputZpostz HTTP method to use for uploading)rj�choicesr�z--upload-no-ssl-verifyz'Disable SSL verification for upload url)rjr�r�z--upload-s3-endpointz#Endpoint to upload to for S3 bucketz--upload-s3-regionz!Region to upload to for S3 bucketz--upload-s3-bucketz"Name of the S3 bucket to upload toz--upload-s3-access-keyzAccess key for the S3 bucketz--upload-s3-secret-keyzSecret key for the S3 bucketz--upload-s3-object-prefixzPrefix for the S3 object/keyz--upload-protocol)r0�https�ftp�sftpZs3z$Manually specify the upload protocol�--add-presetz#Add a new named command line preset)r�r�r�z--del-presetz$Delete the named command line presetzCleaner/Masking Optionsz7These options control how data obfuscation is performedz--cleanz	--cleanerz--maskr<zObfuscate sensitive information)r�rjr�r�z	--domainsr@z$Additional domain names to obfuscatez--disable-parsersrAzCDisable specific parsers, so that those elements are not obfuscated)r�rjr�r�z--skip-cleaning-filesz--skip-masking-filesrBzBList of files to skip/ignore during cleaning. Globs are supported.z
--keywordsrHzList of keywords to obfuscatez--keyword-filerIz&Provide a file a keywords to obfuscate)rjr�r�z--no-updaterXz%Do not update the default cleaner mapz
--map-filerPr6z;Provide a previously generated mapping file for obfuscation)r�rjr�z--keep-binary-filesr>zGKeep unprocessable binary files in the archive instead of removing themz--usernamesrbzList of usernames to obfuscate)�add_argument_group�add_argumentr/�str�int�add_mutually_exclusive_group)�clsr�Z
report_grpZ
preset_grpZcleaner_grpr*r*r+�add_parser_options�s��
����
�
��
����
�
�
�
�
���
���
�����
�
���
�
�
���
��������������
�
��
�
���
�����
�zSoSReport.add_parser_optionscCs�|�d�|�d�|�d�|�d�|jdd�}|�d�|�d�|jd	d�}|�d
td��dtd
����|�dtd��d��dddd�}d}|��D]"\}}|jd|d�|��dd�q�|�|�dS)NzSoS Report Detailed Helpz�The report command is the most common use case for SoS, and aims to collect relevant diagnostic and troubleshooting data to assist with issue analysis without actively performing that analysis on the system while it is in use.z�Additionally, sos report archives can be used for ongoing inspection for pre-emptive issue monitoring, such as that done by the Insights project.z�The typical result of an execution of 'sos report' is a tarball that contains troubleshooting command output, copies of config files, and copies of relevant sections of the host filesystem. Root privileges are required for collections.zHow Collections Are Determined)�titlez�SoS report performs its collections by way of 'plugins' that individually specify what files to copy and what commands to run. Plugins typically map to specific components or software packages.aFPlugins may specify different collections on different distributions, and some plugins may only be for specific distributions. Distributions are represented within SoS by 'policies' and may influence how other SoS commands or options function. For example policies can alter where the --upload option defaults to or functions.zSee Alsoz5For information on available options for report, see zsos report --helpz and zman sos-reportzThe following zsos helpz sections may be of interest:
z'Information on the plugin design of sosz!Information on a specific $pluginz+How sos operates on different distributions)zreport.pluginszreport.plugins.$pluginZpoliciesr�	z<36F)r()Z	set_title�add_textr}rr#)r��sectionZpsecZssec�
help_linesZhelplnZln�valuer*r*r+�display_help�sD
�����	����zSoSReport.display_helpcCs$|j�dtdt�d���d��dS)N�
zsos report (version rm)�ui_log�info�_r�r�r*r*r+ry�szSoSReport.print_headercCs.|��|��d�|��|��|��d�|_dS)N)�blockZfibre)Zstorage�networkZnamespaced_networkZfstype)�_get_block_devs�_get_fibre_devs�_get_network_devs�_get_network_namespace_devices�_get_devices_by_fstype�devicesr�r*r*r+r��s��zSoSReport._get_hardware_devicescCs�|jjdkr�|jj��}|dvr6i|j_|j�d�n�|jjsXd|�d�}|j�|�nt||jj��vr�d�	dd�|jj��D��}t
d	|�d
|����n2|jj||jjd<|j�d|jjdj�d
��dS)a[Check the loaded container runtimes, and the policy default runtime
        (if set), against any requested --container-runtime value. This can be
        useful for systems that have multiple runtimes, such as RHCOS, but do
        not have a clearly defined 'default' (or one that is determined based
        entirely on configuration).
        r0)Znone�offZdiabledz0Disabled all container runtimes per user option.zVWARNING: No container runtimes are active, ignoring option to set default runtime to '�'
rcss|]}|dkr|VqdS)rjNr*��.0�pr*r*r+�	<genexpr>�s�z5SoSReport._check_container_runtime.<locals>.<genexpr>zCannot use container runtime 'z1': no such runtime detected. Available runtimes: rjz"Set default container runtime to '�'N)r�r=�lowerrlZruntimesr�r��warning�keys�join�	Exception�name)r�Zcrunr�Zvalidr*r*r+r��s.��
�
��z"SoSReport._check_container_runtimec
Cs�zFg}gd�}|D].}tj�d|���r|�t�d|�d���q|WSty�}z"|j�d|���gWYd}~Sd}~00dS)z�Enumerate a list of fibrechannel devices on this system so that
        plugins can iterate over them

        These devices are used by add_device_cmd() in the Plugin class.
        )Zfc_hostZfc_transportZfc_remote_portsZ	fc_vportsz/sys/class/z/*z!Could not get fibre device list: N)r��path�isdirr��globr�r�r�)r�ZdevsZdevdirsZdevdir�errr*r*r+r��szSoSReport._get_fibre_devsc
s�z�dd�t�d�D�}td�}g�|ddkr^|d��D]"}|��d�dd	�}��|�q:�fd
d�|D�}tt|�t|��}|WSt	y�}z"|j
�d|���gWYd}~Sd}~00dS)
z�Enumerate a list of block devices on this system so that plugins
        can iterate over them

        These devices are used by add_device_cmd() in the Plugin class.
        cSsg|]}d|���qS)z/dev/r*)r��dr*r*r+�
<listcomp>�z-SoSReport._get_block_devs.<locals>.<listcomp>z
/sys/blockzlosetup --all --noheadings�statusr�output�:rcs"g|]}|�d�r|�vr|�qS)Zloop��
startswith�r��dev�Zreal_loop_devicesr*r+r�s
�z!Could not get block device list: N)r�rr	�
splitlines�split�replacer"�list�setr�r�r�)r�Zdevice_listZloop_devicesZloop_devZloop_deviceZghost_loop_devsZdev_listr�r*r�r+r�
szSoSReport._get_block_devscCsd|��i|_dS)Nr�)�_get_network_namespacesrTr�r*r*r+r�!s�zSoSReport._get_namespacesc
Cs�ggggd�}zPtd|jjd�r.|�|���|ds\|j�d�|�|���|��|d<Wn6t	y�}z|j�
d|���WYd}~n
d}~00|S)	aHelper to encapsulate network devices probed by sos. Rather than
        probing lists of distinct device types like we do for storage, we can
        do some introspection of device enumeration where a single interface
        may have multiple device types. E.G an 'ethernet' device could also be
        a bond, and that is pertinent information for device iteration.

        :returns:   A collection of enumerated devices sorted by device type
        :rtype:     ``dict`` with keys being device types
        )�ethernet�bridgeZteam�bondZnmcli)rwr�zZNetwork devices not enumerated by nmcli. Will attempt to manually compile list of devices.r�z%Could not enumerate network devices: N)rr�rw�update�_get_nmcli_devsr�r��
_get_eth_devs�_get_bridge_devsr�r�)r��_devsr�r*r*r+r�&s"��(zSoSReport._get_network_devscCs*i}|jdD]}d|�|�i||<q|S)zqEnumerate the network devices that exist within each network
        namespace that exists on the system
        r�r�)rTr�)r�Z_nmdevsZnmspr*r*r+r�Es

�
z(SoSReport._get_network_namespace_devicesc
Cs�i}z�td�}|ddkrp|d��dd�D]@}|��\}}||vrR|g||<n||�|�|d�|�q.tt|d��|d<Wn6ty�}z|j�d|���WYd}~n
d}~00|S)	z�Use nmcli, if available, to enumerate network devices. From this
        output, manually grok together lists of devices.
        znmcli --fields DEVICE,TYPE devr�rr�rnNr�zCould not parse nmcli devices: )	r	r�r�r"r�r�r�r�r�)r�r�Z_ndevsr�ZdnameZdtyper�r*r*r+r�Ps(zSoSReport._get_nmcli_devsc
s
dg�g}|sdz�fdd�tdd�D�}Wq�ty`}z|j�d|���WYd}~q�d}~00n�zHd|�d�}t|�}|d	d
kr�|d��D]}|�vr�|�|�q�Wn<ty�}z$|j�d|�d
|���WYd}~n
d}~00|dd�|D�dd�|D�d�S)a8Enumerate a list of ethernet network devices so that plugins can
        reliably iterate over the same set of devices without doing piecemeal
        discovery.

        These devices are used by `add_device_cmd()` when `devices` includes
        "ethernet" or "network".

        :param namespace:   Inspect this existing network namespace, if
                            provided
        :type namespace:    ``str``

        :returns:   All valid ethernet devices found, potentially within a
                    given namespace
        :rtype:     ``list``
        Zbonding_masterscsg|]}|�vr|�qSr*r*r��Z	filt_devsr*r+r�{s�z+SoSReport._get_eth_devs.<locals>.<listcomp>z/sys/class/netNz.Failed to manually determine network devices: zip netns exec z ls /sys/class/netr�rr�z'Could not determine network namespace 'z' devices: cSsg|]}|�d�r|�qS)r�r�)r�Zbdr*r*r+r��r�cSsg|]}|�d�r|�qS)�tunr�)r�Ztdr*r*r+r��r�)r�r�r�)rr�r�r�r	r�r")r��	namespaceZ	_eth_devsr�Z_nscmdZ_nsoutZ_nsethr*r�r+r�ds8
�
����zSoSReport._get_eth_devscCs�g}ztddd�}Wn6tyJ}z|j�d|���WYd}~n
d}~00|ddkr�|d��d	d�D]X}z|�|��d�Wqlty�}z$|j�d
|�d|���WYd}~qld}~00ql|S)z�Enumerate a list of bridge devices so that plugins can reliably
        iterate over the same set of bridges.

        These devices are used by `add_device_cmd()` when `devices` includes
        "bridge" or "network".
        z
brctl show���timeoutz$Unable to enumerate bridge devices: Nr�rr�rnz"Could not parse device from line 'z': )r	r�r�r�r�r"r�r�)r�Z_bridgesZ_boutr�Z_bliner*r*r+r��s(�zSoSReport._get_bridge_devscCs\g}td�}|ddkrX|d��D]2}|��s$|dd���rBq$|�|�d�d�q$|S)z�Enumerate a list of network namespaces on this system so that
        plugins can iterate over them

        Note that stderr is not collected, so no handling of error lines.
        zip netnsr�rr�Nrnr)r	r��isspacer"�	partition)r�Zout_nsZip_netnsr'r*r*r+r��sz!SoSReport._get_network_namespacescCs�i}td�}|ddkr|S|d��D]b}|����}t|�dkrP|�dd�d|dvrdd|d<|�|dg�||d�|d�q(|S)	Nzlsblk -snrpo FSTYPE,NAMEr�rr�rn�unknown�extZext4)r	r��stripr�r!�insert�
setdefaultr")r�Z_dev_fstypesr�r'�helperr*r*r+r��sz SoSReport._get_devices_by_fstypecCs4|j|j|j|j|j|j|j|jj|j|j	|j
d�S)N)�cmddir�logdir�rptdir�tmpdirr�rlrw�	verbosityZcmdlineoptsr�rT)r�r�r�r�r�rlrwr�r�r�rTr�r*r*r+�get_commons�s�zSoSReport.get_commonscCs
|j��S�N)r��newr�r*r*r+�
get_temp_file�szSoSReport.get_temp_filecCs4|j�|jd�|j�|jd�|j�|jd�dS)Ni�)�archive�makedirsr�r�r�r�r*r*r+�_make_archive_paths�szSoSReport._make_archive_pathscCsd|_d|_d|_dS)NZsos_commands�sos_logs�sos_reports)r�r�r�r�r*r*r+r�szSoSReport._set_directoriescCs"|jjr|jt_d|_nd|_dS)NTF)r�r��
_exception�sys�
excepthook�
raise_pluginsr�r*r*r+rz�szSoSReport._set_debugcCsLttd�stj��s$t�|||�n$tj|||dtjd�t�t	�
�dS)z* Wrap exception in debugger if not in tty Zps1�)�limit�fileN)�hasattrr�stderr�isatty�__excepthook__�	traceback�print_exception�stdout�print�pdbZpm)�etypeZeval_Zetracer*r*r+r�s�zSoSReport._exceptioncCsV|js|jr>t��\}}}tj|||tjd�t�t�	|�|rR|rR|�
||�dS)N)r)rZexit_processr�exc_inforrr
rrZpost_mortem�_log_plugin_exception)r��plugname�funcr�val�tbr*r*r+�handle_exception�s
zSoSReport.handle_exceptioncCsTt|dd�r(|jj|jtj�dd�d�t|dd�rP|jj|jtj�dd�d�dS)N�sos_log_filer��sos.log�r��sos_ui_log_file�ui.log)�getattrr��add_filerr�r�r�rr�r*r*r+�
_add_sos_logs	s
�
�zSoSReport._add_sos_logscsP�jj}�jjsdSt|d�s"dS|r8��|���s8dSt�fdd�|jD��S)NTr^Fc3s|]}|�jjvVqdSr�)r�r^r�r�r*r+r�r�z+SoSReport._is_in_profile.<locals>.<genexpr>)r�rZr^r�_is_not_specifiedr��any)r��plugin_classrZr*r�r+�_is_in_profiles
zSoSReport._is_in_profilecCs||jjvSr�)r�rS�r��plugin_namer*r*r+�_is_skippedszSoSReport._is_skippedcCs*||�����o(||jjvo(||jjvSr�)r�Z
check_enabledr�rFrZ�r�r%ZpluginClassr*r*r+�_is_inactive"s

�
�zSoSReport._is_inactivecCs*||�����o(||jjvo(||jjvSr�)r�Zdefault_enabledr�rFrZr'r*r*r+�_is_not_default's

�
�zSoSReport._is_not_defaultcCs|jjo||jjvSr�)r�rZr$r*r*r+r ,s
�zSoSReport._is_not_specifiedr�cCs"|j�|��||���|f�dSr�)rrr"r�r�)r�r"�reasonr*r*r+�_skip0s

�zSoSReport._skipcCs |j�|��||���f�dSr�)rqr"r�r�)r�r"r*r*r+�_load7s
�zSoSReport._loadcCs�tjjj}ttjj�}|��}g|_t�|_t	|j
j�}|jj}g}|j
j
r\|�tjjj�t||�}|jj}t|j
j�}	|D�]�}
tj�|
�\}}�zz|||�}
|
s�Wq�|j�|
�}|||j
j
d��s|j�td|
�d���|j
jdk�r|�|td��Wq�|j�|�|�|�}|�s4|�|td��Wq�|�|��rT|�|td��Wq�|�||��rv|�|td��Wq�|�||��r�|�|td	��Wq�t |d
��r�|j�!|j�|�o�|}|�"|��r�|�r�|�|td��Wq�|jD]}||	v�r�|	�#|��q�|�$|�Wq�t%�y\}z0|j�td|
�d|����|�&�WYd}~q�d}~00q�t	|	�dk�r�|j�'td
d�(|	�����|�)�|�*d�dS)N)rEzplugin z does not validate, skippingrzdoes not validateZexcludedZskippedZinactiveZoptionalr^z
not specifiedz does not install, skipping: z)Unknown or inactive profile(s) provided: rrn)+�sosri�plugins�
import_pluginrZget_modules�plugin_namesr�r^r!r�rlZvalid_subclassesrEr"ZExperimentalPlugin�tuple�validate_pluginr�r�r��splitextZmatch_pluginr�r�r�r�r+r#r&r(r)rr�r �remover,r�rr�r�rNr�)r�r/r�r.Zusing_profilesZpolicy_classesZ
extra_classesZvalid_plugin_classesr2Zremaining_profiles�plugZplugbase�__Zplugin_classesr"Z
in_profileZdefault_profile�i�er*r*r+�load_plugins=s�


��


�
 
�
zSoSReport.load_pluginscCs<|jjr8|jD](\}}|j��D]}t|jvr d|_q qdS)NT)r�r7rq�options�values�boolZval_typer�)r�r6r5�optr*r*r+�_set_all_options�s

zSoSReport._set_all_optionscCs|jj�ri}|jjD]�}z|�d�\}}WntyBd}Yn0t|t�r�|��}|dvrdd}n.|dvrrd}n zt|�}Wnty�Yn0z|�d�\}}Wnty�|}d}Yn0z||Wnty�i||<Yn0||||<q|j	D]�\}}||vr�||D]�}||j
v�rH|j�d|�d|�d	��|�
d
�z:|j
|�|||�|j�d|�d|j
|���Wn<t�y�}z"|j�|�|�
d
�WYd}~n
d}~00�q||=q�|D]}|j�d
|�d���q�|���r|j�d�dS)N�=T)�on�enableZenabled�trueZyes)r��disableZdisabledZfalse�noF�.zno such option "z" for plugin (rmrnzSet z plugin option to zCWARNING: unable to set option for disabled or non-existing plugin (z).r)r�rJr��
ValueError�
isinstancer�r�r��KeyErrorrqr:r�r�r�Z	set_valuer�r�r�)r�r�r=r�argr5rr�r*r*r+�
_set_tunables�sh



�

��$�
zSoSReport._set_tunablescCs�ddl}|�|jj|jj�D]:}|�d�d}||jvr|j�d|�d��|�	d�q|jj
D]"}||jvr`|j�d|�d��q`dS)NrrEza non-existing plugin (z$) was specified in the command line.rnz'Requested to skip non-existing plugin 'z'.)�	itertools�chainr�rZrFr�r0r��fatalr�rSr�)r�rK�pluginr%r*r*r+�_check_for_unknown_plugins�s
�


�z$SoSReport._check_for_unknown_pluginscCs2|jD]&\}}|jD]}|j�|j|�qqdSr�)rqr:rsr")r�r6rNr=r*r*r+�_set_plugin_options�s
zSoSReport._set_plugin_optionscCs�d}g}|jjdkr2|d|jj�d�g7}d|j_|jjsL|dg7}d|j_|jjsf|dg7}d|j_|jjr�|dg7}d	|j_|jjr�|d
g7}d	|j_|r�|dd�|�7}n|d
7}|d7}|S)Nz
Estimate-only mode enabledrnz
--threads=z overriden to 1z--build enabledTz--no-postproc enabledz--clean disabledFz--upload* options disabledz", which overrides some options:
  z
  rEz

)r��threadsr9rWr<rcr�)r�r�Zext_msgr*r*r+�_set_estimate_only�s,



zSoSReport._set_estimate_onlycCsd|j�d�|jr:|j�dt|j��dt|j��d��n|j�dt|j��d��|j�d�dS)Nrrz profiles, z pluginsz	 profiles)r�r�rqr!r^r�r*r*r+�_report_profiles_and_plugins�s�z&SoSReport._report_profiles_and_pluginsc

Cs�|js |js |j�td��dS|jrr|j�td��|j�d�|jD]&\}}|j�d|d�d|�����qHn|j�td��|j�d�|jr�|j�td��|j�d�|jD]0\}}}|j�d|d�d|d	�d|�����q�|j�d�|j�rn|j�td
��|jdd�	�}|D]�}||}|j
}|j
d
k�rx|dk�rZ|jj�pVt
}n|dk�rt|jj�ppt
}nt
}|jdk�r�|jj}|j�d|jd�d|d�d|j����q"|j�d�|j�td��|jD]�}|jdv�r�|j
|jk�r��q�t|j
t��r"|j
du�rd}	nd}	n|j
}	|	du�r6d}	|j�d|j�d|j��d�d|	d�d|j����q�n|j�td��|j�d�t|j�}
|
��td|
dd�}|D]}|j�d|����q�|��dS)Nzno valid plugins foundz,The following plugins are currently enabled:rrz<20zNo plugin enabled.z-The following plugins are currently disabled:z<30z<14z4The following options are available for ALL plugins:rrn���r��cmd-timeout�postprocz<25�<15z+The following plugin options are available:)r�rVrUTr@r�rEz<35zNo plugin options available.z
Profiles: �r$)rqrrr�rMr�r�r�Zget_descriptionrsZget_default_plugin_optsr�r�r\r
r]r�rWr?rjrGr<rNr�r^�sortr,rS)
r�rr5Z	plugclassr*�	_defaultsZ_optr=rZtmpoptr^r&r'r*r*r+rLsv"�



*

��
zSoSReport.list_pluginsc	Cs�|js|j�td��dS|j�td��|j�d�dd�}t|j�}|��|D]b}g}|jD]$\}}||�rb||jvrb|�	|�qbt
|d�|dd�}|D]}|j�d	|���q�qT|��dS)
Nzno valid profiles foundz%The following profiles are available:rcSs
t|d�S)Nr^)r)�cr*r*r+�	_has_profWsz*SoSReport.list_profiles.<locals>._has_profrWTrXr)r^r�rMr�r�r�r�rYrqr"r,rS)	r�r\r^Zprofiler.r�rNr&r'r*r*r+rNPs"
zSoSReport.list_profilescCs|jjs|j�td��dS|j�td��|j�d�|jj��D]�}|sNqD|j�|�}|j�dd�d|j	���|j�dd�d|j
���|jr�|j�dd�d|j���|jj
d	kr�|j��}d
d�d�}t||ddd�}|D]}|j�|�q�|j�d�qDdS)
Nzno valid presets foundz$The following presets are available:rzname:z>14rzdescription:znote:rzoptions:T)r$r%)rlZpresetsr�rMr�r�r�r��find_presetr�r?rYr�r��to_argsr,)r�r[r�Zoptions_strr&r'r*r*r+rMfs(
zSoSReport.list_presetsc
Cs�|j}|�|�r(|j�d|�d��dS|p2|jj}|p>|jj}z|j||||jd�Wn8ty�}z |j�d|���WYd}~dSd}~00|j	�
d�}|j	d|�|j	|d	d�}|j�d
|�dd�|��d
��dS)z�Add a new command line preset for the current options with the
            specified name.

            :param name: the name of the new preset
            :returns: True on success or False otherwise
        zA preset named 'z' already existsF)r�r?rYr�zCould not add preset: Nr�rrzAdded preset 'z' with options rr�T)
rlr]r�r�r�r?rYrfr�rk�indexr�r�)r�r�r?rYrlr8Z	arg_indexr�r*r*r+rf~s"
 �zSoSReport.add_presetc
Cs�|j}|�|�s(|j�d|�d��dSz|j|d�Wn<tyt}z$|j�t|��d��WYd}~dSd}~00|j�d|�d��d	S)
z�Delete a named command line preset.

            :param name: the name of the preset to delete
            :returns: True on success or False otherwise
        zPreset 'z' not foundF�r�r�NzDeleted preset 'r�T)rlr]r�r�rgr�r�r�)r�r�rlr8r*r*r+rg�s
zSoSReport.del_presetc
Cs�|j��}|jjr||��7}|jjr4|j�|�np|td�7}zt	|�WnVt
yt|j�d�|�d�Yn0t
y�}z|�d|�WYd}~n
d}~00dS)Nz,Press ENTER to continue, or CTRL-C to quit.
zExiting on user cancel�rn)rlZget_msgr�rDrR�batchr�r�r��input�KeyboardInterruptr�r�r�)r�r�r8r*r*r+rb�s
zSoSReport.batchcCsrt��}d}|�d�}tj�|j|�}|j�|�d|�d|�d��|j�d|���|jj	|�d�|dd	�dS)
Nz!caught exception in plugin methodz-plugin-errors.txtz "rEz()"zwriting traceback to r��a)�mode)
r�
format_excr�r�r�r�r�r�r��
add_string)r�rN�methodZtracer�Zplugin_err_logZlogpathr*r*r+r�s
zSoSReport._log_plugin_exceptionc
Cs�|j��z&|j�td��|��|��WdSty�}zJ|jt	vrnt
d�t
d|j�d��t
d�nt
d|����WYd}~nXd}~0ty�}z8|j�
d�|j�
d�t��|j�
|�WYd}~n
d}~00|�d�dS)Nz Setting up archive ...rrz while setting up archivezError setting up archive: z) Unexpected exception setting up archive:rn)rlZpre_workr�r�r�Z
setup_archiver��OSError�errno�fatal_fs_errorsr�strerrorr�r�r�	print_excr��r�r8r*r*r+�prework�s&


"zSoSReport.preworkcCsj|j�td��|jD�]L\}}z�|jj�|�|�t|jj|��t	�
�}|j�d|�|j
|_
|��|��|j�|j�|jjr�|��t	�
�}|j�d|�|j�d||�Wqty�t�Yqt�yD}z\|jtv�r$|j�d�|j�d|j�d��|j�d�|�d�|�|d	�WYd}~qd}~0t�yb|�|d	�Yq0qdS)
Nz Setting up plugins ...Zsetup_startZ	setup_endZ
setup_timerrz while setting up pluginsrn�setup)r�r�r�rqr~r.r}Zset_plugin_manifestrr�nowr{�	add_fieldr�Zadd_default_collectionsrqrur�Z	_env_varsr�r`Zsetup_verifyrdrjrkrlr�rmr�rr��r�rr5�start�endr8r*r*r+rq�s>��
 zSoSReport.setupcCs.g}|�dt���|jjd�|�dd�dS)zWFetch version information from all plugins and store in the report
        version filezsos report: r�zversion.txt)Zcontentr�N)r"rr�rhr�)r�Zversionsr*r*r+�versions
�zSoSReport.versioncCs�|j�td��|j�d�d}g|_g|_|jD] }|d7}|j�||df�q2ztg}t|jj	��$}|�
|jt|j��}Wd�n1s�0Y|D]}|s�|j
�d|���q�|j�d�Wn(ty�|j�d�t�d�Yn0dS)Nz! Running plugins. Please wait ...rrrnzUnexpected plugin task result: z
Exiting on user cancel
)r�r�r��pluglist�
running_plugsrqr"rr�rQ�map�_collect_pluginr�r�r�rdr�r�r�)r�Zplugruncountr7�results�executor�resr*r*r+�collect
s*
�"zSoSReport.collectc	Cs�td���}z||j|ddd}|�|j|�}|jp:d}t��}|j�d|�|j	|d�t��}|j�d|�|j�d||�Wn�t
�yd|d�d	�}|j�d
|�d��|j
�|�|j�|d�|j|ddd��|jdd
�|j��Yn0Wd�n1�s$0Y|jj�r�|j��}	z0td|	���}
t|
d��d�|j|d<Wn"t�y�d|j|d<Yn0t�|	�D]D}tj �!|	|�}tj �"|��r�tj �#|��s�t$|�n
t�%|��q�dS)zaWraps the collect_plugin() method so we can apply a timeout
        against the plugin as a wholernrNZ
start_timer�Zend_timeZrun_timezPlugin z
 timed out�
 r�T)�waitzdu -sB1 r�)&rrqZsubmit�collect_pluginr�rrrr{rs�result�FuturesTimeoutErrorr�r�r�r�ryr4Zset_timeout_hitr�Z_threads�clearr�rDr�Zget_tmp_dirr	r�r�rxr�r�rr�r�r��islinkr�unlink)r�rNZpoolZ_plug�tr�rurvr�r�Zdu�fr*r*r+r{"sB
0

�
zSoSReport._collect_pluginc	
Cs"z*|\}}|j|dd}|j�|�Wnty>YdS0t|j�}d|�d|��d�d|d�dd�d	d
�|jD���d�}|�|�z�|��z|j�	|�Wn&t
y�|j�d|�d
��Yn0z|j�	|�Wn(t
�y|j�d|�d��Yn0d}t|j�t
|jj�k�rR|j�rRddd�dd�dd
�|jD���d�}|j�sf|j�sfd}|�rv|�|�Wn�t�y�Yn�t�y�}zZ|jtv�r�|j�d|j�d��|j�d|j�d��t�d�|�|d�WYd}~n(d}~0t�y|�|d�Yn0dS)NrnFz  Starting rhz<5rrWz [Running: css|]
}|VqdSr�r*r�r*r*r+r�\r�z+SoSReport.collect_plugin.<locals>.<genexpr>�]zCould not remove z from plugin list, ignoring...z& from running plugin list, ignoring...rz  Finishing plugins z<12css|]
}|VqdSr�r*r�r*r*r+r�ur�z
  Finished running pluginsr�z while collecting plugin dataz# Data collected still available at r�r)rqryr"r�r!r��ui_progressr�rxr4rFr�r�r�r�rQrrjrkrlr�r�rmr�r�r�r)	r�rN�countrr5Znumplugs�status_liner�r8r*r*r+r�Ssf
�

�

�
�
���
 zSoSReport.collect_plugincCsR|jjdkr&|jjs&d|�d���}n
|�d�}|jjsNtj�|�tj��dS)Nr�
�Zr�)	r�r�rb�ljust�quietrr
�write�flush)r�r�r*r*r+r��s
zSoSReport.ui_progresscCs@|js
dSd�dd�dd�|jD�D��d}|j�|d�dS)Nr�cSs"g|]\}}|�dt|����qS)r?)r
)r�r�rr*r*r+r��sz.SoSReport.collect_env_vars.<locals>.<listcomp>cSs.g|]&}tj�|�dur|tj�|��f�qSr�)r��environ�get)r�r�r*r*r+r��s�Zenvironment)rur�r�rh)r��envr*r*r+�collect_env_vars�s
��zSoSReport.collect_env_varsc
Cs�t�}|jD]�\}}t|d�}|jD]}|�t|��q$|jrN|�t|j��|jD]"}|�t	|dd|dd��qT|j
D]4}|�t|ddtj
�d|��d|d	�d
��q~|jD]&\}}}|�t|tj
�d|�d��q�|�|�qtddftd
dftddff}	|	D]�\}
}}zT|��}
|
|���}|�dd���}|
�|�|
��|jj|
tj
�d|�d�Wnpt�y�}zV|jtv�r�|j �!d�|j �!d|j"�d|�d��|j �!d�|�#d�WYd}~n
d}~00�qdS)Nr`Zsrcpathz..Zdstpath)r��href�cmdrr�r)r�Zreturn_coder�zsos.txt�textzsos.jsonZJSONzsos.htmlZHTML�utf-8r�r�rrrz while writing z reportrn)$rrqrZalerts�addrZcustom_textrZcopied_filesrZexecuted_commandsrr�r�r�r�Zcopy_stringsrrrrr�Zunicode�encode�decoder�r�r�rrjrkrlr�r�rmr�)r�rirr5r�Zalertr�r�r6Z
formatlist�class_�filename�type_�fdr�r8r*r*r+�generate_reports�s\



�


��
�
�
��zSoSReport.generate_reportscCs|jD�]\}}zh|�d�rdt��}|j�d|�|��t��}|j�d|�|j�d||�n|j�d|���Wqt	y�}zZ|j
tvr�|j�
d�|j�
d|j�d��|j�
d�|�d	�|�|d�WYd}~qd}~0t�y|�|d�Yq0qdS)
NrVZpostproc_startZpostproc_endZ
postproc_timezSkipping postproc for plugin rrz" while post-processing plugin datarn)rqZ
get_optionrrrr{rsrVr�r�rjrkrlr�r�rmr�rr�rtr*r*r+rV�s.
�
�
 zSoSReport.postproccCs�|sdSzXd}t�|�}t|d��,}|�|�}|s4q@|�|�q$Wd�n1sT0YWntyz|��Yn0|��S)NFi�rb)�hashlibr��open�readr�r�rZ	hexdigest)r�r��	hash_nameZ	hash_sizeZdigestZ
archive_fpZhashdatar*r*r+�_create_checksum�s

.zSoSReport._create_checksumcCsLt|d|ddd��"}|r*|�|d�Wd�n1s>0YdS)NrE�wr�)�encodingr�)r�r�)r�r�r��checksum�fpr*r*r+�_write_checksum�szSoSReport._write_checksumc
sRd}d}d}|��d}|jjr�zJ|j|j|j|j|jd�}td|d�}|�|j	�
��|��\}}d}Wn6ty�}zt
td|����WYd}~n
d}~00|��|jdur�|j	�|jj�|��|�r(tj�|j|j	j�}	|�tj�|	dd��|�tj�|	dd��|�tj�|	d	d
��|jj�r:|��|jj�r"ddlm�dd
lm}
|
|j�}tdd�|� d�D��|j!d<�t|j!�"���}|j#�$d|���t%|j!�&�dd�dd�dd�}
d��fdd�|
D��}|j#�$d|���|j#�$d�|j#�$d�|j#�$d�|j#�$d�|jj'�s*t�(d�}|jj�sLt
td��z�z&|�rb|j	�)|�|j	�*|jj�}Wn�t+�y�}zRt
d�t
td|j,�d |j	�
�����t
d�|j-t.v�r�|�/d!�WYd}~n6d}~0t�y|jj0�r��YWt�(|�dS0Wt�(|�nt�(|�0n�|jj1�s>|jj2�rJ|j#�3d"�|j	�
�}tj�4|�}|�rp|�5|�}z$tj�|j|�}t�6||�|}Wn(t+�y�t
td#|����YdS0d}|jj'�s:|�s�t
d$��qNz|j�7�}|�8||�}Wn"t�yt
td%��YdS0z|�9|||�Wn&t+�yTt
td&|����Yn0tj�4|�}|�rz|�5|�:d'd(��}tj�|j|�}t�;|�}|d)|}|d)|}zt�6||�|}Wn(t+�y�t
td*|����YdS0zt�6||�Wn&t+�y t
td+|����Yn0|jj<|||||d,�n|jj<||||d,�|jj=�sl|jj>�sl|jj?�r|jj'�szP|j|j|j|j|jd�}t@|jA|jB|jCd||d-�}|��|j#�$td.��Wn8t�y�}z|j#�Dd/|���WYd}~n
d}~00nd0}|j#�D|�tE�F�|jG�r,|jG��|j�rNtj�H|j��rNtI|j�dS)1NF)rlr��sys_tmpr:r{T)�in_place�hook_commonsz#ERROR: Unable to obfuscate report: r�rrr�z
manifest.jsonr��get_human_readable)�Pathcss|]}|��jVqdSr�)�lstat�st_size)r�r�r*r*r+r�:sz'SoSReport.final_work.<locals>.<genexpr>z**/*Zsos_logs_reportszNEstimated disk space requirement for whole uncompressed sos report directory: cSs|dS)Nrnr*)�xr*r*r+�<lambda>Ar�z&SoSReport.final_work.<locals>.<lambda>)�key�reverse�z,  c3s(|] \}}|�d�|dd���VqdS)z: r)Z	precisionNr*)r�r��vr�r*r+r�Bs�zFive biggest plugins:  rz>Please note the estimation is relevant to the current options.z�Be aware that the real disk space requirements might be different. A rule of thumb is to reserve at least double the estimation.�?zCreating compressed archive...rz while finalizing archive rnzQ
Unable to encrypt when using --build. Encryption is only available for archives.zError moving directory: z Creating archive tarball failed.z:Error generating archive checksum after archive creation.
z!Error writing checksum for file: z.tarz-obfuscated.tarrEzError moving archive file: zError moving checksum file: )rP)r�r�rkr�r�r�zUploaded archive successfullyzUpload attempt failed: zEUnable to upload archive when using --build as no archive is created.)J�generate_manifest_tag_summaryr�r<rlr�r�r{rZset_target_pathr�Zget_archive_path�executer�rr�rZadd_final_manifest_dataZcompression_typeZ_obfuscate_upload_passwordsr�r�r��_nameZobfuscate_filer�Zadd_ui_log_to_stdoutrD�
sos.utilitiesr��pathlibr��sumr�rxr;r�r��sortedr#r9�umaskZrename_archive_root�finalizerjrmrkrlr�r�Zencrypt_passZencrypt_keyr��basenameZobfuscate_string�renameZget_preferred_hash_namer�r�r��statZdisplay_resultsrcrdrerr�r�rkr�r�r�r�r�r)r�r�Z	directoryrPZdo_cleanr�ZcleanerZ_pathsr�Z_dirr�Ztmpdir_pathZ_sumZ
bigpluginsZbp_outZ	old_umaskr8Zdir_nameZ	final_dirr�r�Zbase_archive�
final_nameZarchivestatZarchive_hashZ
final_hashZuploaderr�r*r�r+�
final_worksF�(
�


��
���


��


�




�
���
��*

zSoSReport.final_workcCs|js|j�td��dSdS)Nzno valid plugins were enabledFT)rqr�r�r�r�r*r*r+�verify_plugins�szSoSReport.verify_pluginscCs|j�d|j�|j�d|jr&|jjnd�|j�d|jj�d}td�r~t	dt
�����}|dd	kr~|d
��d	�
d�}|j�d�|jj�d
|�|jj�dt
�d	��|j�d�|j��D]\}}|jj�||�q�|j�d|jj�|j�d|jj�|j�d�dS)zgAdd 'global' data to the manifest, that is any information that is
        not plugin-specific
        rwr[Zunsetr^r�Zionicez
ionice -p r�rr�r��priorityZio_classZnicenessr�Zenabled_pluginsZdisabled_pluginsr.N)r~rsrwr[r�Zadd_listr�r^rr	r��getpidr�r�r}r��nicer�r#rFrS)r�Z	_io_class�_ior�r�r*r*r+�add_manifest_data�s&�zSoSReport.add_manifest_datacs|d�fdd�	}i�|jjD]B}|jD]}||�q$|jD]}||d�q8|jD]}||�qNq|j�dtt������dS)acAdd a section to the manifest that contains a dict summarizing the
        tags that were created and assigned during this report's creation.

        This summary dict can be used for easier inspection of tagged items by
        inspection/analyzer projects such as Red Hat Insights. The format of
        this dict is `{tag_name: [file_list]}`.
        �filepathc	s~|dD]p}||r|sqz�|}Wnty<g}Yn0|�t||t�rX||n||g�ttt|����|<qdS)N�tags)rHr�rGr�r�r�)Zentr��tagr���tag_summaryr*r+�compile_tagss
�z=SoSReport.generate_manifest_tag_summary.<locals>.compile_tagsZfiles_copiedr�N)r�)	r~r.Zcommands�files�collectionsrs�dictr�r#)r�r�r5r�Z_fileZ
collectionr*r�r+r��s




�z'SoSReport.generate_manifest_tag_summaryc	Cs�|j�dt�dd�|j��d��|jj��}dt�d|jj�dd�|��d�}|j�|�|j�dt�dd�|j������dS)	N�[z:setup] executing 'sos rr�z:setup] using 'z' preset defaults (rmz:setup] effective options now: )	r�r��__name__r�rkr[r�r^r�)r�Zpreset_argsr�r*r*r+�_merge_preset_optionss
�
��zSoSReport._merge_preset_optionsc
Cs��z8|j�|���|��|��|��|��|��|��|j	j
rX|�
�t�|j	jrl|��t�|j	j
r�|�
�t�|j	jr�|�|j	j�t�|j	jr�|�|j	j�t�|��s�t�|��|��|��|��|��|j	js�|��|j	j�s
|��|j	j�s|��n|j�d�|��|��WSt �yt|j	j!�rV�t"�#dd�dk�sp|�$�Yn|t%�y�|j�&d�|�$�|�'d�YnLt�y�}z2t"�#dd�dk�s�|�$�t(�)|j*�WYd}~n
d}~00|�'d�dS)Nz)Skipping postprocessing of collected dataZ
SOS_TEST_LOGSZkeepz
Exiting on user cancelrarnF)+rlZset_commonsr�r9r>r�rJrOrPr�rL�
SystemExitrNrMrfrgr�rbrpr�rqrrVr�rUr�rWrVr�r�rwr�rjr�r��getenvZcleanuprdr�r�r�exit�coderor*r*r+r�*sl




"
zSoSReport.execute)N)NN)r�)rr)Jr��
__module__�__qualname__�__doc__r?Z
root_requiredr
Zarg_defaultsrp�classmethodr�r�ryr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrz�staticmethodrrrr#r&r(r)r r+r,r9r>rJrOrPrRrSrLrNrMrfrgrbrrprqrwrr{r�r�r�r�rVr�r�r�r�r�r�r�r��
__classcell__r*r*r�r+r3Rs�A'
N
6
2



O;
I
	
17	
7Z r3)Fr)7rrr�rkr�r�rrr��concurrent.futuresrrr��shutilrZsos.report.pluginsr-r�rrrr	r
rrr
rr�rZ
sos.componentrZsos.policiesZsos.report.reportingrrrrrrrrrrZsos.cleanerrZ
sos.uploadr�ENOSPCZEROFSrlr,r/r�rtr3r*r*r*r+�<module>
s4(0
	

Zerion Mini Shell 1.0