HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/sos/report/__pycache__/__init__.cpython-36.pyc
3

mk�h�=�@s`ddlZddlZddlZddlZddlZddlZddlZddlmZddlZddl	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�Z3dddgZ4ddddddhZ5Gdd�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}xB|D]:}t|�t|�t|�dkrR|j|�|}|||}q$W|t|�d�|kr�|dt|��}|j|�|S)N� ��H)�len�append)Z
first_line�items�indent�sep�lines�line�newline�item�r*�/usr/lib/python3.6/__init__.py�_format_list.s


r,cCstj|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)rZstrptime)Zdater*r*r+�
_format_since@sr-�auto�alwaysZneverZ
http_proxyZhttps_proxyZ
HTTP_PROXYZHTTPS_PROXYZNO_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 archiveTFrr.�dN�z /etc/sos/cleaner/default_mapping)>�
alloptions�all_logs�build�case_id�chroot�clean�container_runtime�keep_binary_files�desc�domains�disable_parsers�skip_cleaning_filesZdry_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�j|||�g|_g|_g|_t|_||_d|_i|_	|j
�|j�|jj
�|_|jjjd�|_|j�d}|jj|_|jjr�d}n|jj�r�|jtjkr�d}|jjd|j�d|�d��|jjtkr�|jjd	|jj���tj�|jj �|j!d
�|j"�|j#�|j$�dS)N�/�report�default�cmdline�policyzset sysroot to 'z' (�)zinvalid chroot mode: �)%�super�__init__�loaded_plugins�skipped_plugins�all_options�default_env_vars�env_varsZ_args�sysroot�estimated_plugsizes�print_header�
_set_debugrgZis_rootZ_is_root�manifestZ
components�add_section�	report_md�_set_directories�optsZin_container�osr%�soslog�debugr7�chroot_modes�error�logging�shutdown�
tempfile_utilr8�_exit�_check_container_runtime�_get_namespaces�_get_hardware_devices)�self�parser�argsrf�msg)�	__class__r*r+rk�s8


zSoSReport.__init__c
Cs�|jdd�}|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�ddd�d�gd�d��|jd�ddd�d��|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�dd�d �|jd�ddd�d�d�d�gd�d��|j�}|jd�tdd�d��|jd�tdd�d��|jd�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_truer3Fz%enable all options for loaded plugins)�action�destre�helpz
--all-logsr4z-collect all available logs regardless of sizez--sinceZstorerZzbEscapes archived files older than date. This will also affect --all-logs. Format: YYYYMMDD[HHMMSS])r�r�re�typer�z--buildr5z;preserve the temporary directory and do not package resultsz	--case-idr6zspecify case identifier)r�r�r�z-cz--chrootr7r.zHchroot executed commands to SYSROOT [auto, always, never] (default=auto)z--container-runtimezLDefault container runtime to use for collections. 'auto' for policy control.)rer�z--descz
--descriptionrzDescription for a new preset)r�r�rer�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--experimentalr@zenable experimental pluginsz-ez--enable-plugins�extendrAzenable these plugins)r�r�r�r�rez--journal-sizer1rBz+limit the size of collected journals in MiB)r�rer�r�z-kz--plugin-optionz
--plugoptsrEz7plugin options in plugname.option=value format (see -l)z--labelz--namerFz"specify an additional report labelz-lz--list-pluginsrGz)list plugins and available plugin optionsz--list-presetsz#display a list of available presetsz--list-profilesrIzBdisplay a list of available profiles and plugins that they includez
--log-sizerJr2z6limit the size of collected logs (not journals) in MiB)r�r�r�rer�z--low-priorityz(generate report with low system priority)r�rer�z--namespaceszDlimit number of namespaces to collect output for - 0 means unlimitedz-nz--skip-pluginsrNzdisable these pluginsz--no-reportrPz disable plaintext/HTML reportingz
--no-env-varsrQz$Do not collect environment variablesz
--no-postprocrRzDisable all post-processing)rer�r�r�z--notezBehaviour notes for new presetz-oz--only-pluginsrUzenable these plugins onlyz--presetzA preset identifier)r�r�r�rez--plugin-timeoutzset a timeout for all pluginsz
--cmd-timeoutz%set a command timeout for all pluginsz-pz	--profilez
--profilesrYz)enable plugins used by the given profilesz--skip-commandsrLzdo not execute these commands)rer�r�r�z--skip-filesrMzdo not collect these filesz--verifyr[z+perform data verification during collectionz--allow-system-changesr\zJRun 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-methodZputZpostz HTTP method to use for uploading)re�choicesr�z--upload-no-ssl-verifyz'Disable SSL verification for upload url)rer�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-protocolZhttpsZftpZsftpZs3z$Manually specify the upload protocolz--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--maskr8zObfuscate sensitive information)r�rer�r�z	--domainsr<z$Additional domain names to obfuscatez--disable-parsersr=zCDisable specific parsers, so that those elements are not obfuscated)r�rer�r�z--skip-cleaning-filesz--skip-masking-filesr>zBList of files to skip/ignore during cleaning. Globs are supported.z
--keywordsrCzList of keywords to obfuscatez--keyword-filerDz&Provide a file a keywords to obfuscate)rer�r�z--no-updaterSz%Do not update the default cleaner mapz
--map-filerKz /etc/sos/cleaner/default_mappingz;Provide a previously generated mapping file for obfuscation)r�rer�z--keep-binary-filesr:zGKeep unprocessable binary files in the archive instead of removing themz--usernamesr]zList of usernames to obfuscate)Zadd_argument_group�add_argumentr-�str�intZadd_mutually_exclusive_group)�clsr�Z
report_grpZ
preset_grpZcleaner_grpr*r*r+�add_parser_options�s\


























zSoSReport.add_parser_optionscCs�|jd�|jd�|jd�|jd�|jdd�}|jd�|jd�|jd	d�}|jd
td��dtd
����|jdtd��d��dddd�}d}x.|j�D]"\}}|jd|d�|��dd�q�W|j|�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_titleZadd_textrvrr#)r��sectionZpsecZssecZ
help_linesZhelpln�ln�valuer*r*r+�display_help�s.
zSoSReport.display_helpcCs$|jjdtdt�d���d��dS)N�
zsos report (version rh)�ui_log�info�_r)r�r*r*r+rs�szSoSReport.print_headercCs.|j�|j�d�|j�|j�|j�d�|_dS)N)�blockZfibre)Zstorage�networkZnamespaced_networkZfstype)�_get_block_devs�_get_fibre_devs�_get_network_devs�_get_network_namespace_devices�_get_devices_by_fstype�devices)r�r*r*r+r��s

zSoSReport._get_hardware_devicescCs�|jjdkr�|jjj�}|dkr6i|j_|jjd�n�|jjsXd|�d�}|jj|�nt||jjj�kr�dj	d	d
�|jjj�D��}t
d|�d|����n2|jj||jjd
<|jjd|jjd
j�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).
        r.�none�off�diabledz0Disabled all container runtimes per user option.zVWARNING: No container runtimes are active, ignoring option to set default runtime to 'z'
z, css|]}|dkr|VqdS)reNr*)�.0�pr*r*r+�	<genexpr>�sz5SoSReport._check_container_runtime.<locals>.<genexpr>zCannot use container runtime 'z1': no such runtime detected. Available runtimes: rez"Set default container runtime to '�'N)r�r�r�)ryr9�lowerrgZruntimesr{r��warning�keys�join�	Exception�name)r�Zcrunr�Zvalidr*r*r+r��sz"SoSReport._check_container_runtimecCs�yLg}ddddg}x6|D].}tjjd|���r|jtjd|�d���qW|Stk
r~}z|jjd|���gSd}~XnXdS)	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)rz�path�isdirr��globr�r{r~)r�ZdevsZdevdirsZdevdir�errr*r*r+r��s
zSoSReport._get_fibre_devscs�y�dd�tjd�D�}td�}g�|ddkrbx2|dj�D]"}|j�djdd	�}�j|�q<W�fd
d�|D�}tt|�t|��}|St	k
r�}z|j
jd|���gSd}~XnXd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>sz-SoSReport._get_block_devs.<locals>.<listcomp>z
/sys/blockzlosetup --all --noheadings�statusr�output�:rcs"g|]}|jd�r|�kr|�qS)Zloop)�
startswith)r��dev)�real_loop_devicesr*r+r�s
z!Could not get block device list: N)rzrr	�
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|j�i|_dS)Nr�)�_get_network_namespacesrO)r�r*r*r+r�!szSoSReport._get_namespacescCs�ggggd�}yPtd|jjd�r.|j|j��|ds\|jjd�|j|j��|j�|d<Wn4t	k
r�}z|jj
d|���WYdd}~XnX|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)rqr�zZNetwork devices not enumerated by nmcli. Will attempt to manually compile list of devices.r�z%Could not enumerate network devices: N)rryrq�update�_get_nmcli_devsr{r|�
_get_eth_devs�_get_bridge_devsr�r�)r��_devsr�r*r*r+r�&s$zSoSReport._get_network_devscCs.i}x$|jdD]}d|j|�i||<qW|S)zqEnumerate the network devices that exist within each network
        namespace that exists on the system
        r�r�)rOr�)r�Z_nmdevsZnmspr*r*r+r�Esz(SoSReport._get_network_namespace_devicescCs�i}y�td�}|ddkrtxX|dj�dd�D]@}|j�\}}||krT|g||<n||j|�|dj|�q0Wtt|d��|d<Wn4tk
r�}z|jjd|���WYdd}~XnX|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�riNr�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_devscs
dg�g}|sby�fdd�tdd�D�}Wq�tk
r^}z|jjd|���WYdd}~Xq�Xn�yLd|�d�}t|�}|d	d
kr�x&|dj�D]}|�kr�|j|�q�WWn:tk
r�}z|jjd|�d
|���WYdd}~XnX|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|]}|�kr|�qSr*r*)r�r�)�	filt_devsr*r+r�|sz+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|]}|jd�r|�qS)r�)r�)r�Zbdr*r*r+r��scSsg|]}|jd�r|�qS)�tun)r�)r�Ztdr*r*r+r��s)r�r�r�)rr�r{r�r	r�r")r��	namespaceZ	_eth_devsr�Z_nscmdZ_nsoutZ_nsethr*)r�r+r�ds* $zSoSReport._get_eth_devsc Cs�g}ytddd�}Wn4tk
rH}z|jjd|���WYdd}~XnX|ddkr�xn|dj�d	d�D]V}y|j|j�d�Wqltk
r�}z|jjd
|�d|���WYdd}~XqlXqlW|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�riz"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�}|ddkr\xB|dj�D]2}|j�s&|dd�j�rDq&|j|jd�d�q&W|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�Nrir)r	r��isspacer"�	partition)r�Zout_nsZip_netnsr'r*r*r+r��sz!SoSReport._get_network_namespacescCs�i}td�}|ddkr|Sxr|dj�D]b}|j�j�}t|�dkrR|jdd�d|dkrfd|d<|j|dg�||dj|d�q*W|S)	Nzlsblk -snrpo FSTYPE,NAMEr�rr�ri�unknownZextZext4)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{rgrq�	verbosityZcmdlineoptsr�rO)r�r�r�r�r{rgrqryr�r�rO)r�r*r*r+�get_commons�szSoSReport.get_commonscCs
|jj�S)N)r��new)r�r*r*r+�
get_temp_file�szSoSReport.get_temp_filecCs4|jj|jd�|jj|jd�|jj|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+rx�szSoSReport._set_directoriescCs"|jjr|jt_d|_nd|_dS)NTF)ryr|�
_exception�sys�
excepthook�
raise_plugins)r�r*r*r+rt�szSoSReport._set_debugcCsNttd�stjj�r&tj|||�n$tj|||dtjd�t�t	j
�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>tj�\}}}tj|||tjd�t�tj	|�|rR|rR|j
||�dS)N)r�)r�Zexit_processr��exc_infor�r�r�r�r�Zpost_mortem�_log_plugin_exception)r��plugname�funcr��val�tbr*r*r+�handle_exception�s
zSoSReport.handle_exceptioncCsTt|dd�r(|jj|jtjjdd�d�t|dd�rP|jj|jtjjdd�d�dS)N�sos_log_filer�zsos.log)r��sos_ui_log_filezui.log)�getattrr��add_filerrzr�r�r)r�r*r*r+�
_add_sos_logs	s

zSoSReport._add_sos_logscsR�jj}�jjsdSt|d�s"dS|r:�j|j��r:dSt�fdd�|jD��S)NTrYFc3s|]}|�jjkVqdS)N)ryrY)r�r�)r�r*r+r�sz+SoSReport._is_in_profile.<locals>.<genexpr>)ryrUrYr��_is_not_specifiedr��any)r��plugin_classrUr*)r�r+�_is_in_profiles
zSoSReport._is_in_profilecCs||jjkS)N)ryrN)r��plugin_namer*r*r+�_is_skippedszSoSReport._is_skippedcCs*||j��j�o(||jjko(||jjkS)N)r�Z
check_enabledryrArU)r�r
�pluginClassr*r*r+�_is_inactive"szSoSReport._is_inactivecCs*||j��j�o(||jjko(||jjkS)N)r�Zdefault_enabledryrArU)r�r
rr*r*r+�_is_not_default'szSoSReport._is_not_defaultcCs|jjo||jjkS)N)ryrU)r�r
r*r*r+r,szSoSReport._is_not_specifiedr�cCs"|jj|j�||j��|f�dS)N)rmr"r�r�)r�r�reasonr*r*r+�_skip0s
zSoSReport._skipcCs |jj|j�||j��f�dS)N)rlr"r�r�)r�rr*r*r+�_load7szSoSReport._loadcCs�tjjj}ttjj�}|j�}g|_t�|_t	|j
j�}|jj}g}|j
j
r\|jtjjj�t||�}|jj}t|j
j�}	�x�|D�]�}
tjj|
�\}}�yp|||�}
|
s�w�|jj|
�}|||j
j
d��s|jjtd|
�d���|j
jdk�r|j|td��w�|jj|�|j|�}|�s2|j|td��w�|j|��rP|j|td��w�|j||��rp|j|td��w�|j||��r�|j|td	��w�t |d
��r�|jj!|j�|�o�|}|j"|��r�|�r�|j|td��w�x$|jD]}||	k�r�|	j#|��q�W|j$|�Wq�t%k
�rT}z*|jjtd|
�d|����|j&�WYdd}~Xq�Xq�Wt	|	�dk�r�|jj'td
dj(|	�����|j)�|j*d�dS)N)r@zplugin z does not validate, skippingrzdoes not validateZexcludedZskippedZinactiveZoptionalrYz
not specifiedz does not install, skipping: z)Unknown or inactive profile(s) provided: z, ri)+�sosrd�plugins�
import_pluginrZget_modules�plugin_namesr�rYr!ryrgZvalid_subclassesr@r"ZExperimentalPlugin�tuple�validate_pluginr�rzr��splitextZmatch_pluginr{r�r�r�rr	rr
rr�r�r�removerr�rr~r�rIr�)r�rr�rZusing_profilesZpolicy_classesZ
extra_classesZvalid_plugin_classesrZremaining_profiles�plugZplugbase�__Zplugin_classesrZ
in_profileZdefault_profile�i�er*r*r+�load_plugins=st



zSoSReport.load_pluginscCsD|jjr@x6|jD],\}}x"|jj�D]}t|jkr$d|_q$WqWdS)NT)ryr3rl�options�values�boolZval_typer�)r�rr�optr*r*r+�_set_all_options�s

zSoSReport._set_all_optionsc$Cs$|jj�r i}�x�|jjD]�}y|jd�\}}Wntk
rHd}YnXt|t�r�|j�}|dkrjd}n0|dkrxd
}n"yt|�}Wntk
r�YnXy|jd�\}}Wntk
r�|}d}YnXy||Wntk
�r�i||<YnX||||<qWx�|j	D]�\}}||k�rx�||D]�}||j
k�r^|jjd|�d|�d��|j
d�y:|j
|j|||�|jjd|�d|j
|���Wn:tk
�r�}z|jj|�|j
d�WYdd}~XnX�q*W||=�qWx"|D]}|jjd|�d���q�W|j��r |jjd�dS)N�=T�on�enable�enabled�true�yesr��disable�disabled�false�noF�.zno such option "z" for plugin (rhrizSet z plugin option to zCWARNING: unable to set option for disabled or non-existing plugin (z).r)r%r&r'r(r))r�r*r+r,r-)ryrEr��
ValueError�
isinstancer�r�r��KeyErrorrlrr{r~r�Z	set_valuer|r�r�)r�ryr"r��argrr�r�r*r*r+�
_set_tunables�sZ





"

zSoSReport._set_tunablescCs�ddl}xR|j|jj|jj�D]:}|jd�d}||jkr|jjd|�d��|j	d�qWx.|jj
D]"}||jkrf|jjd|�d��qfWdS)Nrr.za non-existing plugin (z$) was specified in the command line.riz'Requested to skip non-existing plugin 'z'.)�	itertools�chainryrUrAr�rr{�fatalr�rNr�)r�r4�pluginr
r*r*r+�_check_for_unknown_plugins�s

z$SoSReport._check_for_unknown_pluginscCs:x4|jD]*\}}x |jD]}|jj|j|�qWqWdS)N)rlrrnr")r�rr7r"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j|�7}n|d
7}|d7}|S)Nz
Estimate-only mode enabledriz
--threads=z overriden to 1z--build enabledTz--no-postproc enabledz--clean disabledFz--upload* options disabledz", which overrides some options:
  z
  r.z

)ry�threadsr5rRr8r^r�)r�r�Zext_msgr*r*r+�_set_estimate_only�s,



zSoSReport._set_estimate_onlycCsd|jjd�|jr:|jjdt|j��dt|j��d��n|jjdt|j��d��|jjd�dS)Nrrz profiles, z pluginsz	 profiles)r�r�rlr!rY)r�r*r*r+�_report_profiles_and_plugins�s
(z&SoSReport._report_profiles_and_pluginsc
Cs�|jr$|jr$|jjtd��dS|jrz|jjtd��|jjd�xB|jD]&\}}|jjd|d�d|j����qNWn|jjtd��|jjd�|jr�|jjtd��|jjd�x:|jD]0\}}}|jjd|d�d|d	�d|j����q�W|jjd�|j�r�|jjtd
��|jddj	�}x�|D]�}||}|j
}|j
dk�r�|d
k�rh|jj�pdt
}n|dk�r�|jj�p~t
}nt
}|jdk�r�|jj}|jjd|jd�d|d�d|j����q0W|jjd�|jjtd��x�|jD]�}|jdk�r|j
|jk�r�q�t|j
t��r4|j
dk�r.d}	nd}	n|j
}	|	dk�rHd}	|jjd|j�d|j��d�d|	d�d|j����q�Wn|jjtd��|jjd�t|j�}
|
j�td|
dd�}x |D]}|jjd|����q�W|j�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:rrir��cmd-timeout�postprocz<25z<15z+The following plugin options are available:Tr%r�r.z<35zNo plugin options available.z
Profiles: )r$���)r�r>r=)rlrmr{r6r�r�r�Zget_descriptionrnZget_default_plugin_optsr�ryrWr
rXr�rRr;rer0r!r7r�rY�sortr,r<)
r�r�rZ	plugclassrZ	_defaultsZ_optr"r�ZtmpoptrYr&r'r*r*r+rGsj$*



,
:

zSoSReport.list_pluginsc	Cs�|js|jjtd��dS|jjtd��|jjd�dd�}t|j�}|j�xr|D]j}g}x.|jD]$\}}||�rf||jkrf|j	|�qfWt
|d�|dd�}x|D]}|jjd	|���q�WqVW|j�dS)
Nzno valid profiles foundz%The following profiles are available:rcSs
t|d�S)NrY)r�)�cr*r*r+�	_has_profWsz*SoSReport.list_profiles.<locals>._has_profz<15T)r$r)rYr{r6r�r�r�r�r@rlr"r,r<)	r�rBrYZprofilerr�r7r&r'r*r*r+rIPs"


zSoSReport.list_profilescCs|jjs|jjtd��dS|jjtd��|jjd�x�|jjj�D]�}|sPqF|jj|�}|jjdd�d|j	���|jjdd�d|j
���|jr�|jjdd�d|j���|jj
d	k�r�|jj�}d
d�d�}t||ddd�}x|D]}|jj|�q�W|jjd�qFWdS)
Nzno valid presets foundz$The following presets are available:rzname:z>14rzdescription:znote:rzoptions:T)r$r%)rgZpresetsr{r6r�r�r�r��find_presetr�r;rTryr��to_argsr,)r�rVr�Zoptions_strr&r'r*r*r+rHfs(

zSoSReport.list_presetscCs�|j}|j|�r(|jjd|�d��dS|p2|jj}|p>|jj}y|j||||jd�Wn2tk
r�}z|jjd|���dSd}~XnX|j	j
d�}|j	d|�|j	|d	d�}|jjd
|�ddj|��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;rTryzCould not add preset: Nz--add-presetrr�zAdded preset 'z' with options rr�T)
rgrCr�r~ryr;rTrar�rf�indexr�r�)r�r�r;rTrgrZ	arg_indexr�r*r*r+ra~s 
 zSoSReport.add_presetcCs�|j}|j|�s(|jjd|�d��dSy|j|d�Wn6tk
rn}z|jjt|��d��dSd}~XnX|jjd|�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 'z'
T)rgrCr�r~rbr�r�r�)r�r�rgrr*r*r+rb�s
zSoSReport.del_presetcCs�|jj�}|jjr||j�7}|jjr4|jj|�np|td�7}yt	|�WnVt
k
rv|jjd�|jd�Yn.t
k
r�}z|jd|�WYdd}~XnXdS)Nz,Press ENTER to continue, or CTRL-C to quit.
zExiting on user cancel�ri)rgZget_msgryr?r;�batchr�r�r��input�KeyboardInterruptr~r�r�)r�r�rr*r*r+rG�s
zSoSReport.batchcCsrtj�}d}|�d�}tjj|j|�}|jj|�d|�d|�d��|jjd|���|jj	|�d�|dd	�dS)
Nz!caught exception in plugin methodz-plugin-errors.txtz "r.z()"zwriting traceback to r��a)�mode)
r��
format_excrzr�r�r�r{r~r��
add_string)r�r7�methodZtracer�Zplugin_err_logZlogpathr*r*r+r��s
zSoSReport._log_plugin_exceptioncCs�|jj�y$|jjtd��|j�|j�dStk
r�}zD|jt	krnt
d�t
d|j�d��t
d�nt
d|����WYdd}~XnNtk
r�}z2|jj
d�|jj
d�tj�|jj
|�WYdd}~XnX|jd�dS)Nz Setting up archive ...rrz while setting up archivezError setting up archive: z) Unexpected exception setting up archive:ri)rgZpre_workr�r�r�Z
setup_archiver��OSError�errno�fatal_fs_errorsr��strerrorr�r~r��	print_excr�)r�rr*r*r+�prework�s&


zSoSReport.preworkcCsr|jjtd���xZ|jD�]N\}}y�|jjj|�|jt|jj|��t	j
�}|jjd|�|j
|_
|j�|j�|jj|j�|jjr�|j�t	j
�}|jjd|�|jjd||�Wqtk
r�t�Yqtk
�rH}zV|jtk�r,|jjd�|jjd|j�d��|jjd�|jd�|j|d	�WYdd}~Xqtk
�rh|j|d	�YqXqWdS)
Nz Setting up plugins ...Zsetup_startZ	setup_endZ
setup_timerrz while setting up pluginsri�setup)r�r�r�rlrwrrvZset_plugin_manifestrr�nowru�	add_fieldr�Zadd_default_collectionsrUrpr�Z	_env_varsryr[Zsetup_verifyrIrOrPrQr~rRr�rr�)r�r�r�start�endrr*r*r+rU�s:
zSoSReport.setupcCs.g}|jdt���|jjdj|�dd�dS)zWFetch version information from all plugins and store in the report
        version filezsos report: r�zversion.txt)Zcontentr�N)r"rr�rMr�)r�Zversionsr*r*r+�versionszSoSReport.versioncCs�|jjtd��|jjd�d}g|_g|_x*|jD] }|d7}|jj||df�q4Wydg}t|jj	��}|j
|jt|j��}WdQRXx"|D]}|s�|j
jd|���q�W|jjd�Wn*tk
r�|jjd�tjd�YnXdS)Nz! Running plugins. Please wait ...rrrizUnexpected plugin task result: z
Exiting on user cancel
)r�r�r��pluglist�
running_plugsrlr"rryr:�map�_collect_pluginr�r{r|rIr~rzr�)r�Zplugruncountr�results�executor�resr*r*r+�collect
s(
zSoSReport.collectcCs�td���
}y||j|ddd}|j|j|�}|jp:d}tj�}|jjd|�|j	|d�tj�}|jjd|�|jjd||�Wn�t
k
�rd|d�d	�}|jjd
|�d��|j
j|�|jj|d�|j|dddj�|jdd
�|jj�YnXWdQRX|jj�r�|jj�}	y0td|	���}
t|
dj�d�|j|d<Wn$tk
�r�d|j|d<YnXxTtj|	�D]F}tj j!|	|�}tj j"|��r�tj j#|��r�t$|�n
tj%|��q�WdS)zaWraps the collect_plugin() method so we can apply a timeout
        against the plugin as a wholerirNZ
start_time)r�Zend_timeZrun_timezPlugin z
 timed outz
 r�T)�waitzdu -sB1 r�)&rrlZsubmit�collect_pluginr�rrVrurW�result�FuturesTimeoutErrorr�r~r{r�r\rZset_timeout_hitr�Z_threads�clearryr?r�Zget_tmp_dirr	r�r�rrr�rzrr�r�r��islinkr�unlink)r�r7ZpoolZ_plug�tr�rXrYr�r�Zdu�fr*r*r+r^"s@


"
zSoSReport._collect_pluginc	$Cs,y*|\}}|j|dd}|jj|�Wntk
r>dSXt|j�}d|�d|��d�d|d�ddjd	d
�|jD���d�}|j|�y�|j�y|jj	|�Wn(t
k
r�|jjd|�d
��YnXy|jj	|�Wn*t
k
�r
|jjd|�d��YnXd}t|j�t
|jj�k�rV|j�rVddd�ddjdd
�|jD���d�}|j�rn|j�rnd}|�r~|j|�Wn�tk
�r�Yn�tk
�r}zT|jtk�r�|jjd|j�d��|jjd|j�d��tjd�|j|d�WYdd}~Xn"tk
�r&|j|d�YnXdS)NriFz  Starting rcz<5rz<15z [Running: css|]
}|VqdS)Nr*)r�r�r*r*r+r�[sz+SoSReport.collect_plugin.<locals>.<genexpr>�]zCould not remove z from plugin list, ignoring...z& from running plugin list, ignoring...rz  Finishing plugins z<12css|]
}|VqdS)Nr*)r�r�r*r*r+r�tsz
  Finished running pluginsz
 z while collecting plugin dataz# Data collected still available at r�rb)rlr\r"r�r!r��ui_progressrdr[rr/r{r|r�ryr:rrOrPrQr�r~rRr�rzr�r)	r�r7�countr�rZnumplugs�status_liner�rr*r*r+rdSsT
8
&
zSoSReport.collect_plugincCsT|jjdkr(|jjr(d|jd���}n
|�d�}|jjsPtjj|�tjj�dS)Nr�
�Zr�)	ryr�rG�ljust�quietr�r��write�flush)r�ror*r*r+rm�s
zSoSReport.ui_progresscCs@|js
dSdjdd�dd�|jD�D��d}|jj|d�dS)Nr�cSs"g|]\}}|�dt|����qS)r$)r
)r�r�r�r*r*r+r��sz.SoSReport.collect_env_vars.<locals>.<listcomp>cSs.g|]&}tjj|�dk	r|tjj|��f�qS)N)rz�environ�get)r�r�r*r*r+r��sZenvironment)rpr�r�rM)r��envr*r*r+�collect_env_vars�szSoSReport.collect_env_varscCs�t�}x�|jD]�\}}t|d�}x|jD]}|jt|��q(W|jrT|jt|j��x,|jD]"}|jt	|dd|dd��q\Wx>|j
D]4}|jt|ddtj
jd|j�d|d	�d
��q�Wx0|jD]&\}}}|jt|tj
jd|�d��q�W|j|�qWtddftd
dftddff}	x�|	D]�\}
}}yT|j�}
|
|�j�}|jdd�j�}|
j|�|
j�|jj|
tj
jd|�d�Wnntk
�r�}zP|jtk�r�|j j!d�|j j!d|j"�d|�d��|j j!d�|j#d�WYdd}~XnX�q$WdS)N)r�Zsrcpathz..Zdstpath)r��href�cmdrr�r�)r�Zreturn_coderzzsos.txt�textzsos.jsonZJSONzsos.htmlZHTMLzutf-8r�r�)r�rrz while writing z reportri)$rrlrZalerts�addrZcustom_textrZcopied_filesrZexecuted_commandsrrzr�r�r�Zcopy_stringsrrrrr�Zunicode�encode�decodertrur�rrOrPrQr�r~rRr�)r�rdr�rr�Zalertrkr{rZ
formatlistZclass_�filenameZtype_�fdr�rr*r*r+�generate_reports�sN


zSoSReport.generate_reportscCs�x|jD�]\}}yh|jd�rhtj�}|jjd|�|j�tj�}|jjd|�|jjd||�n|jjd|���Wq
t	k
r�}zT|j
tkr�|jj
d�|jj
d|j�d��|jj
d�|jd	�|j|d�WYdd}~Xq
tk
�r|j|d�Yq
Xq
WdS)
Nr>Zpostproc_startZpostproc_endZ
postproc_timezSkipping postproc for plugin rrz" while post-processing plugin datari)rlZ
get_optionrrVrurWr>r{r�rOrPrQr�r~rRr�rr�)r�r�rrXrYrr*r*r+r>�s*


zSoSReport.postproccCsv|sdSyHd}tj|�}t|d��&}x|j|�}|s6P|j|�q&WWdQRXWntk
rl|j�YnX|j�S)NFir��rbi)�hashlibr��open�readr�r�rZ	hexdigest)r�r��	hash_nameZ	hash_sizeZdigestZ
archive_fpZhashdatar*r*r+�_create_checksum�s

zSoSReport._create_checksumc
Cs8t|d|ddd��}|r*|j|d�WdQRXdS)Nr.�wzutf-8)�encodingr�)r�rt)r�r�r��checksum�fpr*r*r+�_write_checksum�szSoSReport._write_checksumcRs:d}d}d}|j�d}|jjr�yJ|j|j|j|j|jd�}td|d�}|j|j	j
��|j�\}}d}Wn4tk
r�}zt
td|����WYdd}~XnX|j�|jdk	r�|j	j|jj�|j�|�r&tjj|j|j	j�}	|jtjj|	dd��|jtjj|	dd��|jtjj|	d	d
��|jj�r8|j�|jj�r ddlm�dd
lm}
|
|j�}tdd�|j d�D��|j!d<�t|j!j"���}|j#j$d|���t%|j!j&�dd�dd�dd�}
dj�fdd�|
D��}|j#j$d|���|j#j$d�|j#j$d�|j#j$d�|j#j$d�|jj'�stj(d�}|jj�sJt
td��z�y&|�r`|j	j)|�|j	j*|jj�}Wn�t+k
�r�}zLt
d�t
td|j,�d |j	j
�����t
d�|j-t.k�r�|j/d!�WYdd}~Xn"tk
�r�|jj0�r��dSXWdtj(|�Xn�|jj1�s$|jj2�r0|j#j3d"�|j	j
�}tjj4|�}|�rV|j5|�}y$tjj|j|�}tj6||�|}Wn(t+k
�r�t
td#|����dSXd}|jj'�s$|�s�t
d$��q8y|jj7�}|j8||�}Wn"tk
�rt
td%��dSXy|j9|||�Wn(t+k
�r<t
td&|����YnXtjj4|�}|�rb|j5|j:d'd(��}tjj|j|�}tj;|�}|d)|}|d)|}ytj6||�|}Wn(t+k
�r�t
td*|����dSXytj6||�Wn(t+k
�r
t
td+|����YnX|jj<|||||d,�n|jj<||||d,�|jj=�sV|jj>�sV|jj?�r�|jj'�s�yP|j|j|j|j|jd�}t@|jA|jB|jCd||d-�}|j�|j#j$td.��Wn6tk
�r�}z|j#jDd/|���WYdd}~XnXnd0}|j#jD|�tEjF�|jG�r|jGj�|j�r6tjjH|j��r6tI|j�dS)1NF)rgr��sys_tmprruT)�in_place�hook_commonsz#ERROR: Unable to obfuscate report: r�zsos.logzui.logr�z
manifest.jsonr)�get_human_readable)�Pathcss|]}|j�jVqdS)N)�lstat�st_size)r�rkr*r*r+r�;sz'SoSReport.final_work.<locals>.<genexpr>z**/*Zsos_logs_reportszNEstimated disk space requirement for whole uncompressed sos report directory: cSs|dS)Nrir*)�xr*r*r+�<lambda>Asz&SoSReport.final_work.<locals>.<lambda>)�key�reverse�z,  c3s(|] \}}|�d�|dd���VqdS)z: r)Z	precisionNr*)r�r��v)r�r*r+r�BszFive 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 rizQ
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.tarr.zError moving archive file: zError moving checksum file: )rK)r�r�rfr�r�r�zUploaded archive successfullyzUpload attempt failed: zEUnable to upload archive when using --build as no archive is created.)J�generate_manifest_tag_summaryryr8rgr�r�rurZset_target_pathr�Zget_archive_path�executer�r�r�rZadd_final_manifest_dataZcompression_typeZ_obfuscate_upload_passwordsrzr�r��_nameZobfuscate_filersZadd_ui_log_to_stdoutr?�
sos.utilitiesr�Zpathlibr��sumr�rrr r�r��sortedr#r5�umaskZrename_archive_root�finalizerOrRrPrQr�r|Zencrypt_passZencrypt_keyr��basenameZobfuscate_string�renameZget_preferred_hash_namer�r�r��statZdisplay_resultsr^r_r`rr�r�rfr~rr�r�r�r)r�r�Z	directoryrKZdo_cleanr�ZcleanerZ_pathsr�Z_dirr�Ztmpdir_pathZ_sumZ
bigpluginsZbp_outZ	old_umaskrZdir_nameZ	final_dirr�r�Zbase_archiveZ
final_nameZarchivestatZarchive_hashZ
final_hashZuploaderr�r*)r�r+�
final_works
$








 









&

zSoSReport.final_workcCs|js|jjtd��dSdS)Nzno valid plugins were enabledFT)rlr{r~r�)r�r*r*r+�verify_plugins�szSoSReport.verify_pluginscCs|jjd|j�|jjd|jr&|jjnd�|jjd|jj�d}td�r~t	dt
j����}|dd	kr~|d
j�d	j
d�}|jjd�|jjjd
|�|jjjdt
jd	��|jjd�x&|jj�D]\}}|jjj||�q�W|jjd|jj�|jjd|jj�|jjd�dS)zgAdd 'global' data to the manifest, that is any information that is
        not plugin-specific
        rqrVZunsetrYr�Zionicez
ionice -p r�rr�r��priorityZio_classZnicenessr�Zenabled_pluginsZdisabled_pluginsrN)rwrWrqrVr�Zadd_listryrYrr	rz�getpidr�r�rvr��nicer�r#rArN)r�Z	_io_class�_ior�r�r*r*r+�add_manifest_data�s$zSoSReport.add_manifest_datacs�d�fdd�	}i�xZ|jjD]N}x|jD]}||�q(Wx|jD]}||d�q@Wx|jD]}||�qZWqW|jjdtt�j����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�x�|dD]v}||s
|r q
y�|}Wntk
rDg}YnX|jt||t�r`||n||g�ttt|����|<q
WdS)NZtags)r1r�r0r�r�r�)Zentr��tagr�)�tag_summaryr*r+�compile_tagss
"z=SoSReport.generate_manifest_tag_summary.<locals>.compile_tagsZfiles_copiedr�N)r�)	rwrZcommands�files�collectionsrW�dictr�r#)r�r�rr{Z_fileZ
collectionr*)r�r+r��s
z'SoSReport.generate_manifest_tag_summarycCs�|jjdt�ddj|j��d��|jjj�}dt�d|jj�ddj|��d�}|jj|�|jjdt�ddj|jj�����dS)	N�[z:setup] executing 'sos rr�z:setup] using 'z' preset defaults (rhz:setup] effective options now: )	r{r��__name__r�rfrVryrDr�)r�Zpreset_argsr�r*r*r+�_merge_preset_optionss
""zSoSReport._merge_preset_optionscCs��y6|jj|j��|j�|j�|j�|j�|j�|j�|j	j
rX|j
�t�|j	jrl|j�t�|j	j
r�|j
�t�|j	jr�|j|j	j�t�|j	jr�|j|j	j�t�|j�s�t�|j�|j�|j�|j�|j�|j	js�|j�|j	j�s
|j�|j	j�s|j�n|jjd�|j�|j�St k
�rt|j	j!�rV�t"j#dd�dk�sp|j$�Yn|t%k
�r�|jj&d�|j$�|j'd�YnJtk
�r�}z,t"j#dd�dk�s�|j$�t(j)|j*�WYdd}~XnX|j'd�dS)Nz)Skipping postprocessing of collected dataZ
SOS_TEST_LOGSZkeepz
Exiting on user cancelrFriF)+rgZset_commonsr�rr#r�r3r8r9ryrG�
SystemExitrIrHrarbr�rGrTr�rUrbrQryrPr�rRr>r�r�rZr�rOr|rz�getenvZcleanuprIr~r�r��exit�code)r�rr*r*r+r�*sl




zSoSReport.execute)N)NN)r�)rr)Jr��
__module__�__qualname__�__doc__r;Z
root_requiredr
Zarg_defaultsrk�classmethodr�r�rsr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rxrt�staticmethodr�rrr	rr
rrrrrr#r3r8r9r;r<rGrIrHrarbrGr�rTrUrZrbr^rdrmryr�r>r�r�r�r�r�r�r�r��
__classcell__r*r*)r�r+r0Rs'O7
2


O;
I
	
17	
7Z r0)Fr)7r�r�rzrPrr�r�rr��concurrent.futuresrrrfZshutilrZsos.report.pluginsrr�rrrr	r
rrr
rr�rZ
sos.componentrZsos.policiesZsos.report.reportingrrrrrrrrrrZsos.cleanerrZ
sos.uploadrZENOSPCZEROFSrQr,r-r}ror0r*r*r*r+�<module>
s6(0