NineSec Team Shell
Server IP : 184.107.3.203  /  Your IP : 216.73.216.51
Web Server : Apache
System : Linux dedicated2.avenfashion.com.ph 4.18.0-553.40.1.el8_10.x86_64 #1 SMP Mon Feb 10 12:11:18 EST 2025 x86_64
User : adminteladeoro ( 1015)
PHP Version : 8.2.28
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/lib/python3.6/site-packages/sos/report/__pycache__/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/lib/python3.6/site-packages/sos/report/__pycache__/__init__.cpython-36.pyc
3

~�g�=�@sLddlZddlZddlZddlZddlZddlZddlZddlmZddlZddl	m
Z
ddl	mZddl
mZddlZddlmZmZmZmZmZmZmZddlmZddlmZdd	lmZddlZdd
lm 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.ej/fZ0ddd�Z1dd�Z2dddgZ3Gdd�de�Z4dS)�N)�datetime)�ThreadPoolExecutor)�TimeoutError)�rmtree)�ImporterHelper�SoSTimeoutError�bold�sos_get_command_output�TIMEOUT_DEFAULT�listdir�
is_executable)�_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�alwaysZneverc?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��|jjtk�r|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�set�env_varsZ_args�sysroot�estimated_plugsizes�print_header�
_set_debugrfZis_rootZ_is_root�manifestZ
components�add_section�	report_md�_set_directories�optsZin_container�osr$�soslog�debugr6�chroot_modes�error�logging�shutdown�
tempfile_utilr7�_exit�_check_container_runtime�_get_namespaces�_get_hardware_devices)�self�parser�argsre�msg)�	__class__r)r*rj�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_truer2Fz%enable all options for loaded plugins)�action�destrd�helpz
--all-logsr3z-collect all available logs regardless of sizez--sinceZstorerYzbEscapes archived files older than date. This will also affect --all-logs. Format: YYYYMMDD[HHMMSS])r�r�rd�typer�z--buildr4z;preserve the temporary directory and do not package resultsz	--case-idr5zspecify case identifier)r�r�r�z-cz--chrootr6r-zHchroot executed commands to SYSROOT [auto, always, never] (default=auto)z--container-runtimezLDefault container runtime to use for collections. 'auto' for policy control.)rdr�z--descz
--descriptionrzDescription for a new preset)r�r�rdr�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�extendr@zenable these plugins)r�r�r�r�rdz--journal-sizer0rAz+limit the size of collected journals in MiB)r�rdr�r�z-kz--plugin-optionz
--plugoptsrDz7plugin options in plugname.option=value format (see -l)z--labelz--namerEz"specify an additional report labelz-lz--list-pluginsrFz)list plugins and available plugin optionsz--list-presetsz#display a list of available presetsz--list-profilesrHzBdisplay a list of available profiles and plugins that they includez
--log-sizerIr1z6limit the size of collected logs (not journals) in MiB)r�r�r�rdr�z--low-priorityz(generate report with low system priority)r�rdr�z--namespaceszDlimit number of namespaces to collect output for - 0 means unlimitedz-nz--skip-pluginsrMzdisable these pluginsz--no-reportrOz disable plaintext/HTML reportingz
--no-env-varsrPz$Do not collect environment variablesz
--no-postprocrQzDisable all post-processing)rdr�r�r�z--notezBehaviour notes for new presetz-oz--only-pluginsrTzenable these plugins onlyz--presetzA preset identifier)r�r�r�rdz--plugin-timeoutzset a timeout for all pluginsz
--cmd-timeoutz%set a command timeout for all pluginsz-pz	--profilez
--profilesrXz)enable plugins used by the given profilesz--skip-commandsrKzdo not execute these commands)rdr�r�r�z--skip-filesrLzdo not collect these filesz--verifyrZz+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)rd�choicesr�z--upload-no-ssl-verifyz'Disable SSL verification for upload url)rdr�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--maskr7zObfuscate sensitive information)r�rdr�r�z	--domainsr;z$Additional domain names to obfuscatez--disable-parsersr<zCDisable specific parsers, so that those elements are not obfuscated)r�rdr�r�z--skip-cleaning-filesz--skip-masking-filesr=zBList of files to skip/ignore during cleaning. Globs are supported.z
--keywordsrBzList of keywords to obfuscatez--keyword-filerCz&Provide a file a keywords to obfuscate)rdr�r�z--no-updaterRz%Do not update the default cleaner mapz
--map-filerJz /etc/sos/cleaner/default_mappingz;Provide a previously generated mapping file for obfuscation)r�rdr�z--keep-binary-filesr9zGKeep 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_textrurr")r��sectionZpsecZssecZ
help_linesZhelpln�ln�valuer)r)r*�display_help�s.
zSoSReport.display_helpcCs tdtdt�d���d��dS)N�
zsos report (version rg)�print�_r)r�r)r)r*rr�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)rdNr))�.0�pr)r)r*�	<genexpr>�sz5SoSReport._check_container_runtime.<locals>.<genexpr>zCannot use container runtime 'z1': no such runtime detected. Available runtimes: rdz"Set default container runtime to '�'N)r�r�r�)rxr8�lowerrfZruntimesrz�info�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)ry�path�isdirr��globr�rzr})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)ryrr	�
splitlines�split�replacer!�listrnr�rzr})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_namespacesrN)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)rpr�zZNetwork devices not enumerated by nmcli. Will attempt to manually compile list of devices.r�z%Could not enumerate network devices: N)rrxrp�update�_get_nmcli_devsrzr{�
_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�)rNr�)r�Z_nmdevsZnmspr)r)r*r�?sz(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�rhNr�zCould not parse nmcli devices: )	r	r�r�r!r�rnr�rzr{)r�r�Z_ndevsr�ZdnameZdtyper�r)r)r*r�Js$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�vsz+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�rzr�r	r�r!)r��	namespaceZ	_eth_devsr�Z_nscmdZ_nsoutZ_nsethr))r�r*r�^s* $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�rhz"Could not parse device from line 'z': )r	r�rzr�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�Nrhr)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�rh�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�tmpdirrzrfrp�	verbosityZcmdlineoptsr�rN)r�r�r�r�rzrfrprxr�r�rN)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*rw�szSoSReport._set_directoriescCs"|jjr|jt_d|_nd|_dS)NTF)rxr{�
_exception�sys�
excepthook�
raise_plugins)r�r)r)r*rs�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�stdoutr��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_filer�ryr�r�r�)r�r)r)r*�
_add_sos_logss

zSoSReport._add_sos_logscsR�jj}�jjsdSt|d�s"dS|r:�j|j��r:dSt�fdd�|jD��S)NTrXFc3s|]}|�jjkVqdS)N)rxrX)r�r�)r�r)r*r�sz+SoSReport._is_in_profile.<locals>.<genexpr>)rxrTrXr��_is_not_specifiedr��any)r��plugin_classrTr))r�r*�_is_in_profiles
zSoSReport._is_in_profilecCs||jjkS)N)rxrM)r��plugin_namer)r)r*�_is_skippedszSoSReport._is_skippedcCs*||j��j�o(||jjko(||jjkS)N)r�Z
check_enabledrxr@rT)r�r�pluginClassr)r)r*�_is_inactiveszSoSReport._is_inactivecCs*||j��j�o(||jjko(||jjkS)N)r�Zdefault_enabledrxr@rT)r�rr	r)r)r*�_is_not_default!szSoSReport._is_not_defaultcCs|jjo||jjkS)N)rxrT)r�rr)r)r*r&szSoSReport._is_not_specifiedr�cCs"|jj|j�||j��|f�dS)N)rlr!r�r�)r�r�reasonr)r)r*�_skip*s
zSoSReport._skipcCs |jj|j�||j��f�dS)N)rkr!r�r�)r�rr)r)r*�_load1szSoSReport._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 validateZexcludedZskippedZinactiveZoptionalrXz
not specifiedz does not install, skipping: z)Unknown or inactive profile(s) provided: z, rh)+�sosrc�plugins�
import_pluginrZget_modules�plugin_namesrnrXr rxrfZvalid_subclassesr?r!ZExperimentalPlugin�tuple�validate_pluginr�ryr��splitextZmatch_pluginrzr�r�r�r
rrr
rr�r�r�removerr�r�r}r�rHr�)r�rr�rZusing_profilesZpolicy_classesZ
extra_classesZvalid_plugin_classesrZremaining_profiles�plugZplugbase�__Zplugin_classesrZ
in_profileZdefault_profile�i�er)r)r*�load_plugins7st



zSoSReport.load_pluginscCsD|jjr@x6|jD],\}}x"|jj�D]}t|jkr$d|_q$WqWdS)NT)rxr2rk�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 (rgrhzSet 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*)rxrDr��
ValueError�
isinstancer�r�r��KeyErrorrkrrzr}r�Z	set_valuer{r�r�)r�rxrr��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.rhz'Requested to skip non-existing plugin 'z'.)�	itertools�chainrxrTr@r�rrz�fatalr�rMr�)r�r1�pluginrr)r)r*�_check_for_unknown_plugins�s

z$SoSReport._check_for_unknown_pluginscCs:x4|jD]*\}}x |jD]}|jj|j|�qWqWdS)N)rkrrmr!)r�rr4rr)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 enabledrhz
--threads=z overriden to 1z--build enabledTz--no-postproc enabledz--clean disabledFz--upload* options disabledz", which overrides some options:
  z
  r+z

)rx�threadsr4rQr7r]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)�ui_logr�rkr rX)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	��|jd
dj	�}x�|D]�}||}|j
}|j
dk�r�|dk�rh|jj�pdt
}n|d
k�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<14z4The following options are available for ALL plugins:rrhr��cmd-timeout�postprocz<25z<15z+The following plugin options are available:Tr"r�r+z<30zNo plugin options available.z
Profiles: )r#���)r�r<r;)rkrlrzr3r�r9r�Zget_descriptionrmZget_default_plugin_optsr�rxrVr
rWr�rQr:rdr-rr4r�rX�sortr+r:)
r�r�rZ	plugclassrZ	_defaultsZ_optrr�ZtmpoptrXr%r&r)r)r*rFsj$*



,
:

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)NrX)r�)�cr)r)r*�	_has_profQsz*SoSReport.list_profiles.<locals>._has_profz<15T)r#r)rXrzr3r�r9r�r�r>rkr!r+r:)	r�r@rXZprofilerr�r4r%r&r)r)r*rHJs"


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$)rfZpresetsrzr3r�r9r�r��find_presetr�r:rSrxr��to_argsr+)r�rUr�Zoptions_strr%r&r)r)r*rG`s(

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:rSrxzCould not add preset: Nz--add-presetrr�zAdded preset 'z' with options rr�T)
rfrAr9r}rxr:rSr`r�re�indexr�r�)r�r�r:rSrfrZ	arg_indexr�r)r)r*r`xs 
 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)rfrAr9r}rar�r�r�)r�r�rfrr)r)r*ra�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�rh)rfZget_msgrxr>r8�batchr9r�r��input�KeyboardInterruptr}r�r�)r�r�rr)r)r*rE�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_excryr�r�r�rzr}r��
add_string)r�r4�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:rh)rfZpre_workr9r�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 pluginsrh�setup)r9r�r�rkrvrruZset_plugin_manifestrr�nowrt�	add_fieldr�Zadd_default_collectionsrSror�Z	_env_varsrxrZZsetup_verifyrGrMrNrOr}rPr�r�r�)r�r�r�start�endrr)r)r*rS�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�rKr�)r�Zversionsr)r)r*�version�szSoSReport.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 ...rrrhzUnexpected plugin task result: z
Exiting on user cancel
)r9r�r��pluglist�
running_plugsrkr!rrxr7�map�_collect_pluginr�rzr{rGr}ryr�)r�Zplugruncountr�results�executor�resr)r)r*�collects(
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 wholerhrNZ
start_time)r�Zend_timeZrun_timezPlugin z
 timed outz
 r�T)�waitzdu -sB1 r�)&rrkZsubmit�collect_pluginr�rrTrtrU�result�FuturesTimeoutErrorr9r}rzr�rZrZset_timeout_hitrZ_threads�clearrxr>r�Zget_tmp_dirr	r�r�rqr�ryrr�r�r��islinkr�unlink)r�r4ZpoolZ_plug�tr�rVrWr�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)NrhFz  Starting rbz<5rz<15z [Running: css|]
}|VqdS)Nr))r�r�r)r)r*r�Usz+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�nsz
  Finished running pluginsz
 z while collecting plugin dataz# Data collected still available at r�r`)rkrZr!r�r r��ui_progressrbrYrr,rzr{r�rxr7rrMrNrOr9r}rPr�ryr�r�)	r�r4�countr�rZnumplugs�status_liner�rr)r)r*rbMsT
8
&
zSoSReport.collect_plugincCsT|jjdkr(|jjr(d|jd���}n
|�d�}|jjsPtjj|�tjj�dS)Nr�
�Zr�)	rxr�rE�ljust�quietr�r��write�flush)r�rmr)r)r*rk�s
zSoSReport.ui_progresscCs@|js
dSdjdd�dd�|jD�D��d}|jj|d�dS)Nr�cSsg|]\}}|�d|���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)ry�environ�get)r�r�r)r)r*r��sZenvironment)ror�r�rK)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_coderxzsos.txt�textzsos.jsonZJSONzsos.htmlZHTMLzutf-8r�r�)r�rrz while writing z reportrh)$rrkrZalerts�addrZcustom_textrZcopied_filesrZexecuted_commandsrryr�r�r�Zcopy_stringsrrrrr�Zunicode�encode�decoderrrsr�rrMrNrOr9r}rPr�)r�rcr�rr�ZalertriryrZ
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 datarh)rkZ
get_optionrrTrtrUr<rzr�rMrNrOr9r}rPr�r�r�)r�r�rrVrWrr)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�r�Z	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�rr)r�r�r��checksum�fpr)r)r*�_write_checksum�szSoSReport._write_checksumcRsFd}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�|�r2tjj|j|j	j�}	|jtjj|	dd�dd�|jtjj|	dd	�d	d�|jtjj|	d
d�dd�|jj�rD|j�|jj�r,dd
lm�ddlm}
|
|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�sVt
td��z�y&|�rl|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�s0|jj2�r<|j#j3d#�|j	j
�}tjj4|�}|�rb|j5|�}y$tjj|j|�}tj6||�|}Wn(t+k
�r�t
td$|����dSXd}|jj'�s0|�s�t
d%��qDy|jj7�}|j8||�}Wn"tk
�rt
td&��dSXy|j9|||�Wn(t+k
�rHt
td'|����YnXtjj4|�}|�rn|j5|j:d(d)��}tjj|j|�}tj;|�}|d*|}|d*|}ytj6||�|}Wn(t+k
�r�t
td+|����dSXytj6||�Wn(t+k
�rt
td,|����YnX|jj<|||||d-�n|jj<||||d-�|jj=�sb|jj>�sb|jj?�r|jj'�s�yP|j|j|j|j|jd�}t@|jA|jB|jCd||d.�}|j�|j#j$td/��Wn6tk
�r�}z|j#jDd0|���WYdd}~XnXnd1}|j#jD|�tEjF�|jG�r |jGj�|j�rBtjjH|j��rBtI|j�dS)2NF)rfr��sys_tmprrtT)�in_place�hook_commonsz#ERROR: Unable to obfuscate report: r�zsos.log)Z
short_namezui.logr�z
manifest.jsonr)�get_human_readable)�Pathcss|]}|j�jVqdS)N)�lstat�st_size)r�rir)r)r*r�8sz'SoSReport.final_work.<locals>.<genexpr>z**/*Zsos_logs_reportszNEstimated disk space requirement for whole uncompressed sos report directory: cSs|dS)Nrhr))�xr)r)r*�<lambda>>sz&SoSReport.final_work.<locals>.<lambda>)�key�reverse�z,  c3s(|] \}}|�d�|dd���VqdS)z: r)Z	precisionNr))r�r��v)r�r)r*r�?szFive 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 rhzQ
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: )rJ)r�r�rer�r�r�zUploaded archive successfullyzUpload attempt failed: zEUnable to upload archive when using --build as no archive is created.)J�generate_manifest_tag_summaryrxr7rfr�r�rtrZset_target_pathr�Zget_archive_path�executer�r�r�rZadd_final_manifest_dataZcompression_typeZ_obfuscate_upload_passwordsryr�r��_nameZobfuscate_filerqZadd_ui_log_to_stdoutr>�
sos.utilitiesr�Zpathlibr��sumr�rqrr9r��sortedr"r4�umaskZrename_archive_root�finalizerMrPrNrOr�r{Zencrypt_passZencrypt_keyr��basenameZobfuscate_string�renameZget_preferred_hash_namer�r�r��statZdisplay_resultsr]r^r_rr�r�rer}r~rr�r�r)r�r�Z	directoryrJZdo_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_work�s$
$








 









&

zSoSReport.final_workcCs|js|jjtd��dSdS)Nzno valid plugins were enabledFT)rkrzr}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
        rprUZunsetrXr�Zionicez
ionice -p r�rr�r��priorityZio_classZnicenessr�Zenabled_pluginsZdisabled_pluginsrN)rvrUrprUr�Zadd_listrxrXrr	ry�getpidr�r�rur��nicer�r"r@rM)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)r.r�r-r�r�rn)Zentr��tagr�)�tag_summaryr)r*�compile_tagss
"z=SoSReport.generate_manifest_tag_summary.<locals>.compile_tagsZfiles_copiedr�N)r�)	rvrZcommands�files�collectionsrU�dictr�r")r�r�rryZ_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 (rgz:setup] effective options now: )	rzr��__name__r�rerUrxrBr�)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 cancelrDrhF)+rfZset_commonsr�rr r�r0r5r6rxrF�
SystemExitrHrGr`rar�rErRr�rSr`rPrwrOr�rQr<r9r�rXr�rMr{ry�getenvZcleanuprGr}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_defaultsrj�classmethodr�r�rrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rwrs�staticmethodr�r�rrrr
rrr
rrr r0r5r6r8r:rFrHrGr`rarEr�rRrSrXr`r\rbrkrwr�r<r�r�r�r�r�r�r�r��
__classcell__r)r))r�r*r/Ls'O7
2


O;
I
	
17	
7] r/)Fr)5r�r�ryrNr~r�r�rr��concurrent.futuresrrrdZshutilrZsos.report.pluginsrr�rrrr	r
rrr
r�rZ
sos.componentrZsos.policiesZsos.report.reportingrrrrrrrrrrZsos.cleanerrZ
sos.uploadrZENOSPCZEROFSrOr+r,r|r/r)r)r)r*�<module>
s2$0
	


NineSec Team - 2022