HEX
Server: Apache
System: Linux server.instantlogomakers.com 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: s2spw (1156)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/sos/report/__pycache__/__init__.cpython-39.pyc
a

G%@iQ@�@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
gggddddddgdeegdddgddddddddddddddddddd�?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/d0�Zd1d2�Zd3d4�Zd5d6�Zed7d8��Zd�d9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dAdB�Z$dCdD�Z%dEdF�Z&d�dHdI�Z'dJdK�Z(dLdM�Z)dNdO�Z*dPdQ�Z+dRdS�Z,dTdU�Z-dVdW�Z.dXdY�Z/dZd[�Z0d\d]�Z1d^d_�Z2d�d`da�Z3dbdc�Z4ddde�Z5dfdg�Z6dhdi�Z7djdk�Z8dldm�Z9dndo�Z:dpdq�Z;drds�Z<dtdu�Z=dvdw�Z>dxdy�Z?dzd{�Z@d|d}�ZAd~d�ZBd�d��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�	obfuscate)?�
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_preset�treat_certificatescst��|||�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_debugrnZis_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�argsrm�msg��	__class__r*r+rr�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��|jd�d�gdѢd�d�dԍdS)�NzReport Optionsz.These options control how report collects dataz-az--alloptions�
store_truer8Fz%enable all options for loaded plugins)�action�destrl�helpz
--all-logsr9z-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�rl�typer�z--buildr:z;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.)rlr�z--descz
--descriptionrzDescription for a new preset)r�r�rlr�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--experimentalrFzenable experimental pluginsz-ez--enable-plugins�extendrGzenable these plugins)r�r�r�r�rlz--journal-sizer4rHz+limit the size of collected journals in MiB)r�rlr�r�z-kz--plugin-optionz
--plugoptsrKz7plugin options in plugname.option=value format (see -l)z--labelz--namerLz"specify an additional report labelz-lz--list-pluginsrMz)list plugins and available plugin optionsz--list-presetsz#display a list of available presetsz--list-profilesrOzBdisplay a list of available profiles and plugins that they includez
--log-sizerPr5z6limit the size of collected logs (not journals) in MiB)r�r�r�rlr�z--low-priorityz(generate report with low system priority)r�rlr�z--namespaceszDlimit number of namespaces to collect output for - 0 means unlimitedz-nz--skip-pluginsrTzdisable these pluginsz--no-reportrVz disable plaintext/HTML reportingz
--no-env-varsrWz$Do not collect environment variablesz
--no-postprocrXzDisable all post-processing)rlr�r�r�z--notezBehaviour notes for new presetz-oz--only-pluginsr[zenable these plugins onlyz--presetzA preset identifier)r�r�r�rlz--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-commandsrRzdo not execute these commands)rlr�r�r�z--skip-filesrSzdo not collect these filesz--verifyraz+perform data verification during collectionz--allow-system-changesrbzJRun 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)rl�choicesr�z--upload-no-ssl-verifyz'Disable SSL verification for upload url)rlr�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�rlr�r�z	--domainsrAz$Additional domain names to obfuscatez--disable-parsersrBzCDisable specific parsers, so that those elements are not obfuscated)r�rlr�r�z--skip-cleaning-filesz--skip-masking-filesrCzBList of files to skip/ignore during cleaning. Globs are supported.z
--keywordsrIzList of keywords to obfuscatez--keyword-filerJz&Provide a file a keywords to obfuscate)rlr�r�z--no-updaterYz%Do not update the default cleaner mapz
--map-filerQr6z;Provide a previously generated mapping file for obfuscation)r�rlr�z--keep-binary-filesr?zGKeep unprocessable binary files in the archive instead of removing themz--usernamesrczList of usernames to obfuscatez--treat-certificatesr7)r7�keep�removeriz�How to treat the certificate files [.csr .crt .pem]. Defaults to "obfuscate" after convert the file to text.  "Key" certificate files are always removed.)rlr�r�r�)�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_textrrr#)r��sectionZpsecZssec�
help_linesZhelplnZln�valuer*r*r+�display_help�sD
�����	����zSoSReport.display_helpcCs$|j�dtdt�d���d��dS)N�
zsos report (version ro)�ui_log�info�_r�r�r*r*r+r{�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)rlNr*��.0�pr*r*r+�	<genexpr>�s�z5SoSReport._check_container_runtime.<locals>.<genexpr>zCannot use container runtime 'z1': no such runtime detected. Available runtimes: rlz"Set default container runtime to '�'N)r�r>�lowerrnZruntimesr�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_namespacesrUr�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)ryr�zZNetwork devices not enumerated by nmcli. Will attempt to manually compile list of devices.r�z%Could not enumerate network devices: N)rr�ry�update�_get_nmcli_devsr�r��
_get_eth_devs�_get_bridge_devsr�r�)r��_devsr�r*r*r+r�0s"��(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�)rUr�)r�Z_nmdevsZnmspr*r*r+r�Os

�
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�rpNr�zCould not parse nmcli devices: )	r	r�r�r"r�r�r�r�r�)r�r�Z_ndevsr�ZdnameZdtyper�r*r*r+r�Zs(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�ns8
�
����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�rpz"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�Nrpr)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�rp�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�rnry�	verbosityZcmdlineoptsr�rU)r�r�r�r�r�rnryr�r�r�rUr�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+r|�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_inforrrrrZpost_mortem�_log_plugin_exception)r��plugname�funcr�val�tbr*r*r+�handle_exceptions
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_logss
�
�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�r[r_r�_is_not_specifiedr��any)r��plugin_classr[r*r�r+�_is_in_profiles
zSoSReport._is_in_profilecCs||jjvSr�)r�rT�r��plugin_namer*r*r+�_is_skipped)szSoSReport._is_skippedcCs*||�����o(||jjvo(||jjvSr�)r�Z
check_enabledr�rGr[�r�r)ZpluginClassr*r*r+�_is_inactive,s

�
�zSoSReport._is_inactivecCs*||�����o(||jjvo(||jjvSr�)r�Zdefault_enabledr�rGr[r+r*r*r+�_is_not_default1s

�
�zSoSReport._is_not_defaultcCs|jjo||jjvSr�)r�r[r(r*r*r+r$6s
�zSoSReport._is_not_specifiedr�cCs"|j�|��||���|f�dSr�)rtr"r�r�)r�r&�reasonr*r*r+�_skip:s

�zSoSReport._skipcCs |j�|��||���f�dSr�)rsr"r�r�)r�r&r*r*r+�_loadAs
�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)rFzplugin z does not validate, skippingrzdoes not validateZexcludedZskippedZinactiveZoptionalr_z
not specifiedz does not install, skipping: z)Unknown or inactive profile(s) provided: rrp)+�sosrk�plugins�
import_pluginrZget_modules�plugin_namesr�r_r!r�rnZvalid_subclassesrFr"ZExperimentalPlugin�tuple�validate_pluginr�r�r��splitextZmatch_pluginr�r�r�r�r/r'r*r,r-rr�r$r�r0r�rr�r�rOr�)r�r3r�r2Zusing_profilesZpolicy_classesZ
extra_classesZvalid_plugin_classesr6Zremaining_profiles�plugZplugbase�__Zplugin_classesr&Z
in_profileZdefault_profile�i�er*r*r+�load_pluginsGs�


��


�
 
�
zSoSReport.load_pluginscCs<|jjr8|jD](\}}|j��D]}t|jvr d|_q qdS)NT)r�r8rs�options�values�boolZval_typer�)r�r9r8�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 (rorpzSet z plugin option to zCWARNING: unable to set option for disabled or non-existing plugin (z).r)r�rKr��
ValueError�
isinstancer�r�r��KeyErrorrsr=r�r�r�Z	set_valuer�r�r�)r�r�r@r�argr8rr�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)NrrHza non-existing plugin (z$) was specified in the command line.rpz'Requested to skip non-existing plugin 'z'.)�	itertools�chainr�r[rGr�r4r��fatalr�rTr�)r�rN�pluginr)r*r*r+�_check_for_unknown_plugins�s
�


�z$SoSReport._check_for_unknown_pluginscCs2|jD]&\}}|jD]}|j�|j|�qqdSr�)rsr=rur")r�r9rQr@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 enabledrpz
--threads=z overriden to 1z--build enabledTz--no-postproc enabledz--clean disabledFz--upload* options disabledz", which overrides some options:
  z
  rHz

)r��threadsr:rXr=rdr�)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�rsr!r_r�r*r*r+�_report_profiles_and_pluginss�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:rrp���r��cmd-timeout�postprocz<25�<15z+The following plugin options are available:)r�rYrXTrCr�rHz<35zNo plugin options available.z
Profiles: �r$)rsrtr�rPr�r�r�Zget_descriptionruZget_default_plugin_optsr�r�r]r
r^r�rXr@rlrJr?rQr�r_�sortr,rV)
r�rr8Z	plugclassr.�	_defaultsZ_optr@rZtmpoptr_r&r'r*r*r+rMsv"�



*

��
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_profasz*SoSReport.list_profiles.<locals>._has_profrZTr[r)r_r�rPr�r�r�r�r\rsr"r,rV)	r�r_r_Zprofiler2r�rQr&r'r*r*r+rOZs"
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%)rnZpresetsr�rPr�r�r�r��find_presetr�r@rZr�r��to_argsr,)r�r\r�Zoptions_strr&r'r*r*r+rNps(
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@rZr�zCould not add preset: Nr�rrzAdded preset 'z' with options rr�T)
rnr`r�r�r�r@rZrgr�rm�indexr�r�)r�r�r@rZrnr;Z	arg_indexr�r*r*r+rg�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)rnr`r�r�rhr�r�r�)r�r�rnr;r*r*r+rh�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�rp)rnZget_msgr�rErU�batchr�r�r��input�KeyboardInterruptr�r�r�)r�r�r;r*r*r+re�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 "rHz()"zwriting traceback to r��a)�mode)
r�
format_excr�r�r�r�r�r�r��
add_string)r�rQ�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:rp)rnZpre_workr�r�r�Z
setup_archiver�OSError�errno�fatal_fs_errorsr�strerrorr�r�r�	print_excr��r�r;r*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 pluginsrp�setup)r�r�r�rsr�r2rZset_plugin_manifestr!r�nowr}�	add_fieldr�Zadd_default_collectionsrtrwr�Z	_env_varsr�raZsetup_verifyrgrmrnror�rpr�rr��r�rr8�start�endr;r*r*r+rt�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�rkr�)r�Zversionsr*r*r+�version
s
�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 ...rrrpzUnexpected plugin task result: z
Exiting on user cancel
)r�r�r��pluglist�
running_plugsrsr"rr�rT�map�_collect_pluginr�r�r�rgr�r�r�)r�Zplugruncountr:�results�executor�resr*r*r+�collects*
�"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 wholerprNZ
start_timer�Zend_timeZrun_timezPlugin z
 timed out�
 r�T)�waitzdu -sB1 r�)&rrsZsubmit�collect_pluginr�rrur}rv�result�FuturesTimeoutErrorr�r�r�r�r|r�Zset_timeout_hitr�Z_threads�clearr�rEr�Zget_tmp_dirr	r�r�rzr�r�rr�r�r��islinkr�unlink)r�rQZpoolZ_plug�tr�rxryr�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)NrpFz  Starting rjz<5rrZz [Running: css|]
}|VqdSr�r*r�r*r*r+r�fr�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�r�z
  Finished running pluginsr�z while collecting plugin dataz# Data collected still available at r�r�)rsr|r"r�r!r��ui_progressr�r{r�rIr�r�r�r�rTrrmrnror�r�rpr�r�r�r)	r�rQ�countrr8Znumplugs�status_liner�r;r*r*r+r�]sf
�

�

�
�
���
 zSoSReport.collect_plugincCsR|jjdkr&|jjs&d|�d���}n
|�d�}|jjsNtj�|�tj��dS)Nr�
�Zr�)	r�r�re�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)rB)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)rwr�r�rk)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)NrcZsrcpathz..Zdstpath)r��href�cmdrr�r
)r�Zreturn_coder�zsos.txt�textzsos.jsonZJSONzsos.htmlZHTML�utf-8r�rrrrz while writing z reportrp)$rrsrZalerts�addrZcustom_textrZcopied_filesrZexecuted_commandsrr�r�r�r�Zcopy_stringsrrrrr�Zunicode�encode�decoder�r�r�r"rmrnror�r�rpr�)r�rkrr8r�Zalertr�r�r9Z
formatlist�class_�filename�type_�fdr�r;r*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)
NrYZpostproc_startZpostproc_endZ
postproc_timezSkipping postproc for plugin rrz" while post-processing plugin datarp)rsZ
get_optionrrur}rvrYr�r�rmrnror�r�rpr�rr�rwr*r*r+rY�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)NrH�wr�)�encodingr�)r�r�)r�r�r��checksum�fpr*r*r+�_write_checksumszSoSReport._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)rnr��sys_tmpr=r}T)�in_place�hook_commonsz#ERROR: Unable to obfuscate report: rrr rz
manifest.jsonr��get_human_readable)�Pathcss|]}|��jVqdSr�)�lstat�st_size)r�r�r*r*r+r�Dsz'SoSReport.final_work.<locals>.<genexpr>z**/*Zsos_logs_reportszNEstimated disk space requirement for whole uncompressed sos report directory: cSs|dS)Nrpr*)�xr*r*r+�<lambda>Kr�z&SoSReport.final_work.<locals>.<lambda>)�key�reverse�z,  c3s(|] \}}|�d�|dd���VqdS)z: r)Z	precisionNr*)r�r��vr�r*r+r�Ls�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 rpzQ
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.tarrHzError moving archive file: zError moving checksum file: )rQ)r�r�rmr�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=rnr�r�r}rZset_target_pathr�Zget_archive_path�executer�rr�r#Zadd_final_manifest_dataZcompression_typeZ_obfuscate_upload_passwordsr�r�r��_nameZobfuscate_filer�Zadd_ui_log_to_stdoutrE�
sos.utilitiesr��pathlibr��sumr�rzr>r�r��sortedr#r:�umaskZrename_archive_root�finalizermrprnror�r�Zencrypt_passZencrypt_keyr��basenameZobfuscate_string�renameZget_preferred_hash_namer�r�r��statZdisplay_resultsrdrerfrr�r�rmr�r�r�r�r�r)r�r�Z	directoryrQZdo_cleanr�ZcleanerZ_pathsr�Z_dirr�Ztmpdir_pathZ_sumZ
bigpluginsZbp_outZ	old_umaskr;Zdir_nameZ	final_dirr�r�Zbase_archive�
final_nameZarchivestatZarchive_hashZ
final_hashZuploaderr�r*r�r+�
final_work
sF�(
�


��
���


��


�




�
���
��*

zSoSReport.final_workcCs|js|j�td��dSdS)Nzno valid plugins were enabledFT)rsr�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
        ryr\Zunsetr_r�Zionicez
ionice -p r�rr�r��priorityZio_classZnicenessr�Zenabled_pluginsZdisabled_pluginsr2N)r�rvryr\r�Zadd_listr�r_rr	r��getpidr�r�rr��nicer�r#rGrT)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)rKr�rJr�r�r�)Zentr��tagr���tag_summaryr*r+�compile_tags
s
�z=SoSReport.generate_manifest_tag_summary.<locals>.compile_tagsZfiles_copiedr�N)r�)	r�r2Zcommands�files�collectionsrv�dictr�r#)r�r�r8r�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 (roz:setup] effective options now: )	r�r��__name__r�rmr\r�rar�)r�Zpreset_argsr�r*r*r+�_merge_preset_options%s
�
��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_LOGSr�z
Exiting on user cancelrdrpF)+rnZset_commonsr�r<rAr�rMrRrSr�rM�
SystemExitrOrNrgrhr�rersr�rtr�rWr�rVr�rXrYr�r�rzr�rmr�r��getenvZcleanuprgr�r�r�exit�coderrr*r*r+r�4sl




"
zSoSReport.execute)N)NN)r�)rr)Jr��
__module__�__qualname__�__doc__r@Z
root_requiredr
Zarg_defaultsrr�classmethodr�r�r{r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�r|�staticmethodrrr#r'r*r,r-r$r/r0r<rArMrRrSrUrVrMrOrNrgrhrerrsrtrzr�r~r�r�r�r�rYr�r�r�r�r�r�r�r��
__classcell__r*r*r�r+r3Rs�B'
W
6
2



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