a Ö>ïhÌ=ã@sVddlZddlZddlZddlZddlZddlZddlZddlmZddlZddl m Z ddl m Z ddl mZddlZddlmZmZmZmZmZmZmZmZddlmZddlmZdd lmZddlZdd l m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*dd l+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_PROXYZ HTTPS_PROXYZNO_PROXYZ https_proxyZ http_proxyZ ALL_PROXYc?s®eZdZdZdZdZdddddddddgggdddgdgdgddddd dd gggddddddgdeegdddgdddddddddddddddddd œ>Z‡fd d „Ze dd„ƒZ e dd„ƒZ dd„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!dd?„Z#d@dA„Z$dBdC„Z%dDdE„Z&ddGdH„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„Zdwdx„Z?dydz„Z@d{d|„ZAd}d~„ZBdd€„ZCdd‚„ZDdƒd„„ZEd…d†„ZFd‡dˆ„ZGd‰dŠ„ZH‡ZIS)Ú SoSReportzaRun a set of commands and file collections and save them to a report for future analysis z.Collect files and command output in an archiveTFrr0édNéú /etc/sos/cleaner/default_mapping)>Ú alloptionsÚall_logsÚbuildÚcase_idÚchrootÚcleanÚcontainer_runtimeÚkeep_binary_filesÚdescÚdomainsÚdisable_parsersÚskip_cleaning_filesÚdry_runÚ estimate_onlyÚ experimentalÚenable_pluginsÚ journal_sizeÚkeywordsÚ keyword_fileÚplugoptsÚlabelÚ list_pluginsÚ list_presetsÚ list_profilesÚlog_sizeZ low_priorityÚmap_fileÚ skip_commandsÚ skip_filesÚ skip_pluginsÚ namespacesÚ no_reportÚ no_env_varsÚ no_postprocÚ no_updateÚnoteÚ only_pluginsÚpresetÚplugin_timeoutÚ cmd_timeoutÚprofilesÚsinceÚverifyÚallow_system_changesÚ usernamesÚuploadÚ upload_urlZupload_directoryZ upload_userZ upload_passZ upload_methodZupload_no_ssl_verifyZupload_protocolÚupload_s3_endpointZupload_s3_regionZupload_s3_bucketZupload_s3_access_keyZupload_s3_secret_keyZupload_s3_object_prefixZ upload_targetÚ add_presetÚ del_presetcstƒ |||¡g|_g|_g|_t|_||_d|_i|_ |  ¡|  ¡|j   ¡|_|jj d¡|_| ¡d}|j j|_|jjrŠd}n|j  ¡r¤|jtjkr¤d}|j d|j›d|›d¡|jjtvrþ|j d |jj›¡t ¡|j  ¡| !d ¡| "¡| #¡| $¡dS) Nú/ÚreportÚdefaultÚcmdlineÚpolicyzset sysroot to 'z' (ú)zinvalid chroot mode: é)%ÚsuperÚ__init__Úloaded_pluginsÚskipped_pluginsÚ all_optionsÚdefault_env_varsÚenv_varsÚ_argsÚsysrootÚestimated_plugsizesÚ print_headerÚ _set_debugrlZis_rootZ_is_rootÚmanifestÚ componentsÚ add_sectionÚ report_mdÚ_set_directoriesÚoptsZ in_containerÚosr%ÚsoslogÚdebugr;Ú chroot_modesÚerrorÚloggingÚshutdownÚ tempfile_utilr<Ú_exitÚ_check_container_runtimeÚ_get_namespacesÚ_get_hardware_devices)ÚselfÚparserÚargsrkÚmsg©Ú __class__r*r+rp›s8     zSoSReport.__init__c CsÂ| dd¡}|jddddddd |jd dd dd 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;d0dd?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€ddd |jd‚dddƒdR|jd„dd…d |jd†dd‡d |jdˆdd‰d |jdŠdd‹d |jdŒdgd¢dŽd|jdddd‘d’|jd“dd”d |jd•dd–d |jd—dd˜d |jd™ddšd |jd›ddœd |jdddžd |jdŸdgd ¢d¡d| ¡}|jd¢tdd£d¤|jd¥tdd¦d¤| d§d¨¡}|jd©dªd«d¬ddd­d®|jd¯d°gd0d±d®|jd²d0gd³d´dµ|jd¶d·d0gd¸d¹dµ|jdºd0gd»d¼dµ|jd½dd¾d¿dÀ|jdÁdddÂdÃdµ|jdÄdÅdÆdÇdÈ|jdÉdddÊdËdx|jdÌdÍgd0dÎd®dS)ÏNzReport Optionsz.These options control how report collects dataz-az --alloptionsÚ store_truer7Fz%enable all options for loaded plugins)ÚactionÚdestrjÚhelpz --all-logsr8z-collect all available logs regardless of sizez--sinceÚstorer_zbEscapes archived files older than date. This will also affect --all-logs. Format: YYYYMMDD[HHMMSS])r”r•rjÚtyper–z--buildr9z;preserve the temporary directory and do not package resultsz --case-idr:zspecify case identifier)r”r•r–z-cz--chrootr;r0zHchroot executed commands to SYSROOT [auto, always, never] (default=auto)z--container-runtimezLDefault container runtime to use for collections. 'auto' for policy control.)rjr–z--descz --descriptionrzDescription for a new preset)r˜r”rjr–z --dry-runz#Run plugins but do not collect data)r”r–z--estimate-onlyzzApproximate disk space requirements for a real sos run; disables --clean and --collect, sets --threads=1 and --no-postprocz--experimentalrEzenable experimental pluginsz-ez--enable-pluginsÚextendrFzenable these plugins)r”r•r˜r–rjz--journal-sizer4rGz+limit the size of collected journals in MiB)r˜rjr•r–z-kz--plugin-optionz --plugoptsrJz7plugin options in plugname.option=value format (see -l)z--labelz--namerKz"specify an additional report labelz-lz--list-pluginsrLz)list plugins and available plugin optionsz--list-presetsz#display a list of available presetsz--list-profilesrNzBdisplay a list of available profiles and plugins that they includez --log-sizerOr5z6limit the size of collected logs (not journals) in MiB)r”r•r˜rjr–z--low-priorityz(generate report with low system priority)r”rjr–z --namespaceszDlimit number of namespaces to collect output for - 0 means unlimitedz-nz--skip-pluginsrSzdisable these pluginsz --no-reportrUz disable plaintext/HTML reportingz --no-env-varsrVz$Do not collect environment variablesz --no-postprocrWzDisable all post-processing)rjr•r”r–z--notezBehaviour notes for new presetz-oz--only-pluginsrZzenable these plugins onlyz--presetzA preset identifier)r”r˜r–rjz--plugin-timeoutzset a timeout for all pluginsz --cmd-timeoutz%set a command timeout for all pluginsz-pz --profilez --profilesr^z)enable plugins used by the given profilesz--skip-commandsrQzdo not execute these commands)rjr”r•r–z --skip-filesrRzdo not collect these filesz--verifyr`z+perform data verification during collectionz--allow-system-changesrazJRun commands even if they can change the system (e.g. load kernel modules)z--uploadz+Upload archive to a policy-default locationz --upload-urlz&Upload the archive to specified serverz--upload-directoryz$Specify upload directory for archivez --upload-userz'Username to authenticate to server withz --upload-passz'Password to authenticate to server withz--upload-method)r0ZputZpostz HTTP method to use for uploading)rjÚchoicesr–z--upload-no-ssl-verifyz'Disable SSL verification for upload url)rjr”r–z--upload-s3-endpointz#Endpoint to upload to for S3 bucketz--upload-s3-regionz!Region to upload to for S3 bucketz--upload-s3-bucketz"Name of the S3 bucket to upload toz--upload-s3-access-keyzAccess key for the S3 bucketz--upload-s3-secret-keyzSecret key for the S3 bucketz--upload-s3-object-prefixzPrefix for the S3 object/keyz--upload-protocol)r0ÚhttpsÚftpÚsftpZs3z$Manually specify the upload protocolú --add-presetz#Add a new named command line preset)r˜r”r–z --del-presetz$Delete the named command line presetzCleaner/Masking Optionsz7These options control how data obfuscation is performedz--cleanz --cleanerz--maskr<zObfuscate sensitive information)r•rjr”r–z --domainsr@z$Additional domain names to obfuscatez--disable-parsersrAzCDisable specific parsers, so that those elements are not obfuscated)r”rjr•r–z--skip-cleaning-filesz--skip-masking-filesrBzBList of files to skip/ignore during cleaning. Globs are supported.z --keywordsrHzList of keywords to obfuscatez--keyword-filerIz&Provide a file a keywords to obfuscate)rjr•r–z --no-updaterXz%Do not update the default cleaner mapz --map-filerPr6z;Provide a previously generated mapping file for obfuscation)r•rjr–z--keep-binary-filesr>zGKeep unprocessable binary files in the archive instead of removing themz --usernamesrbzList of usernames to obfuscate)Úadd_argument_groupÚ add_argumentr/ÚstrÚintÚadd_mutually_exclusive_group)ÚclsrŽZ report_grpZ preset_grpZ cleaner_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›|›ddq | |¡dS)NzSoS Report Detailed HelpzâThe report command is the most common use case for SoS, and aims to collect relevant diagnostic and troubleshooting data to assist with issue analysis without actively performing that analysis on the system while it is in use.z‘Additionally, sos report archives can be used for ongoing inspection for pre-emptive issue monitoring, such as that done by the Insights project.zëThe typical result of an execution of 'sos report' is a tarball that contains troubleshooting command output, copies of config files, and copies of relevant sections of the host filesystem. Root privileges are required for collections.zHow Collections Are Determined)ÚtitlezÁSoS report performs its collections by way of 'plugins' that individually specify what files to copy and what commands to run. Plugins typically map to specific components or software packages.aFPlugins may specify different collections on different distributions, and some plugins may only be for specific distributions. Distributions are represented within SoS by 'policies' and may influence how other SoS commands or options function. For example policies can alter where the --upload option defaults to or functions.zSee Alsoz5For information on available options for report, see zsos report --helpz and zman sos-reportzThe following zsos helpz sections may be of interest: z'Information on the plugin design of sosz!Information on a specific $pluginz+How sos operates on different distributions)zreport.pluginszreport.plugins.$pluginZpoliciesrú z<36F)r()Z set_titleÚadd_textr}rr#)r¤ÚsectionZpsecZssecÚ help_linesZhelplnZlnÚvaluer*r*r+Ú display_helpsD ÿÿÿ ÿÿ ÿÿÿýzSoSReport.display_helpcCs$|j dtdt›dƒ›d¡dS)NÚ zsos report (version rm)Úui_logÚinfoÚ_r©rr*r*r+ryÇszSoSReport.print_headercCs.| ¡| ¡dœ| ¡| ¡| ¡dœ|_dS)N)ÚblockZfibre)ZstorageÚnetworkZnamespaced_networkZfstype)Ú_get_block_devsÚ_get_fibre_devsÚ_get_network_devsÚ_get_network_namespace_devicesÚ_get_devices_by_fstypeÚdevicesr±r*r*r+rŒÊsþùzSoSReport._get_hardware_devicescCsÐ|jjdkrÌ|jj ¡}|dvr6i|j_|j d¡n–|jjsXd|›d}|j |¡nt||jj ¡vršd  dd„|jj ¡Dƒ¡}t d |›d |›ƒ‚n2|jj||jjd <|j d |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). r0)ZnoneÚoffZdiabledz0Disabled all container runtimes per user option.zVWARNING: No container runtimes are active, ignoring option to set default runtime to 'ú' rcss|]}|dkr|VqdS)rjNr*©Ú.0Úpr*r*r+Ú èsÿz5SoSReport._check_container_runtime..zCannot use container runtime 'z1': no such runtime detected. Available runtimes: rjz"Set default container runtime to 'ú'N) r€r=ÚlowerrlZruntimesr‚r¯ÚwarningÚkeysÚjoinÚ ExceptionÚname)rZcrunrZvalidr*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…)rZdevsZdevdirsZdevdirÚ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+Ú óz-SoSReport._get_block_devs..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) rr r Ú splitlinesÚsplitÚreplacer"ÚlistÚsetrÅr‚r…)rZ device_listZ loop_devicesZloop_devZ loop_deviceZghost_loop_devsZdev_listrÊr*rÕr+r´ s  zSoSReport._get_block_devscCsd| ¡i|_dS)Nr³)Ú_get_network_namespacesrTr±r*r*r+r‹!sÿzSoSReport._get_namespacesc Csšggggdœ}zPtd|jjdr.| | ¡¡|ds\|j d¡| | ¡¡| ¡|d<Wn6t y”}z|j  d|›¡WYd}~n d}~00|S) aHelper to encapsulate network devices probed by sos. Rather than probing lists of distinct device types like we do for storage, we can do some introspection of device enumeration where a single interface may have multiple device types. E.G an 'ethernet' device could also be a bond, and that is pertinent information for device iteration. :returns: A collection of enumerated devices sorted by device type :rtype: ``dict`` with keys being device types )ÚethernetÚbridgeZteamÚbondZnmcli)rwrÜzZNetwork devices not enumerated by nmcli. Will attempt to manually compile list of devices.rÝz%Could not enumerate network devices: N) r r€rwÚupdateÚ_get_nmcli_devsr‚rƒÚ _get_eth_devsÚ_get_bridge_devsrÅrÂ)rÚ_devsrÊr*r*r+r¶&s" üÿ(zSoSReport._get_network_devscCs*i}|jdD]}d| |¡i||<q|S)zqEnumerate the network devices that exist within each network namespace that exists on the system r³rÜ)rTrá)rZ_nmdevsZnmspr*r*r+r·Es  ÿ z(SoSReport._get_network_namespace_devicesc CsÂi}z‚tdƒ}|ddkrp|d ¡dd…D]@}| ¡\}}||vrR|g||<n|| |¡|d |¡q.tt|dƒƒ|d<Wn6ty¼}z|j d|›¡WYd}~n d}~00|S) z‚Use nmcli, if available, to enumerate network devices. From this output, manually grok together lists of devices. znmcli --fields DEVICE,TYPE devrÎrrÏrnNrÜzCould not parse nmcli devices: ) r rÖr×r"rÙrÚrÅr‚rƒ)rrãZ_ndevsrÔZdnameZdtyperÊr*r*r+ràPs   (zSoSReport._get_nmcli_devsc s dg‰g}|sdz‡fdd„tddƒDƒ}Wqêty`}z|j d|›¡WYd}~qêd}~00n†zHd|›d}t|ƒ}|d d krª|d  ¡D]}|ˆvr’| |¡q’Wn<tyè}z$|j d |›d |›¡WYd}~n d}~00|dd„|Dƒdd„|DƒdœS)a8Enumerate a list of ethernet network devices so that plugins can reliably iterate over the same set of devices without doing piecemeal discovery. These devices are used by `add_device_cmd()` when `devices` includes "ethernet" or "network". :param namespace: Inspect this existing network namespace, if provided :type namespace: ``str`` :returns: All valid ethernet devices found, potentially within a given namespace :rtype: ``list`` Zbonding_masterscsg|]}|ˆvr|‘qSr*r*rÓ©Z filt_devsr*r+rÌ{sÿz+SoSReport._get_eth_devs..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å)r rÅr‚rÂr r×r")rÚ namespaceZ _eth_devsrÊZ_nscmdZ_nsoutZ_nsethr*rär+ráds8 ÿ ÿ  ÿÿ  ýzSoSReport._get_eth_devsc CsÊg}ztddd}Wn6tyJ}z|j d|›¡WYd}~n d}~00|ddkrÆ|d ¡d d…D]X}z| | ¡d¡WqltyÂ}z$|j d |›d |›¡WYd}~qld}~00ql|S) zãEnumerate a list of bridge devices so that plugins can reliably iterate over the same set of bridges. These devices are used by `add_device_cmd()` when `devices` includes "bridge" or "network". z brctl showé©Útimeoutz$Unable to enumerate bridge devices: NrÎrrÏrnz"Could not parse device from line 'z': )r rÅr‚rÂrÖr"r×r¯)rZ_bridgesZ_boutrÊZ_bliner*r*r+râ–s( ÿzSoSReport._get_bridge_devscCs\g}tdƒ}|ddkrX|d ¡D]2}| ¡s$|dd… ¡rBq$| | d¡d¡q$|S)z·Enumerate a list of network namespaces on this system so that plugins can iterate over them Note that stderr is not collected, so no handling of error lines. zip netnsrÎrrÏNrnr)r rÖÚisspacer"Ú partition)rZout_nsZip_netnsr'r*r*r+rÛ¬s z!SoSReport._get_network_namespacescCsi}tdƒ}|ddkr|S|d ¡D]b}| ¡ ¡}t|ƒdkrP| dd¡d|dvrdd|d<| |dg¡||d |d¡q(|S) Nzlsblk -snrpo FSTYPE,NAMErÎrrÏrnÚunknownÚextZext4)r rÖÚstripr×r!ÚinsertÚ setdefaultr")rZ _dev_fstypesrãr'Úhelperr*r*r+r¸¼s     z SoSReport._get_devices_by_fstypec Cs4|j|j|j|j|j|j|j|jj|j|j |j dœ S)N) ÚcmddirÚlogdirÚrptdirÚtmpdirr‚rlrwÚ verbosityZ cmdlineoptsr¹rT) ròrórôrõr‚rlrwr€rör¹rTr±r*r*r+Ú get_commonsËsõzSoSReport.get_commonscCs |j ¡S©N)rˆÚnewr±r*r*r+Ú get_temp_fileÚszSoSReport.get_temp_filecCs4|j |jd¡|j |jd¡|j |jd¡dS)Nií)ÚarchiveÚmakedirsròrórôr±r*r*r+Ú_make_archive_pathsÝszSoSReport._make_archive_pathscCsd|_d|_d|_dS)NZ sos_commandsÚsos_logsÚ sos_reports)ròrórôr±r*r*r+râszSoSReport._set_directoriescCs"|jjr|jt_d|_nd|_dS)NTF)r€rƒÚ _exceptionÚsysÚ excepthookÚ raise_pluginsr±r*r*r+rzçszSoSReport._set_debugcCsLttdƒstj ¡s$t |||¡n$tj|||dtjdtƒ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|||tjdtƒt  |¡|rR|rR|  ||¡dS)N)r) rZ exit_processrÚexc_infor r r rrZ post_mortemÚ_log_plugin_exception)rÚplugnameÚfuncrÚvalÚtbr*r*r+Úhandle_exceptionýs  zSoSReport.handle_exceptioncCsTt|ddƒr(|jj|jtj dd¡dt|ddƒrP|jj|jtj dd¡ddS)NÚ sos_log_filerþúsos.log©r•Úsos_ui_log_fileúui.log)ÚgetattrrûÚadd_filerrrÇrÄrr±r*r*r+Ú _add_sos_logs s   ÿ   ÿzSoSReport._add_sos_logscsPˆjj}ˆjjsdSt|dƒs"dS|r8ˆ | ¡¡s8dSt‡fdd„|jDƒƒS)NTr^Fc3s|]}|ˆjjvVqdSrø)r€r^r¼r±r*r+r¿rÍz+SoSReport._is_in_profile..)r€rZr^rÚ_is_not_specifiedrÆÚany)rÚ plugin_classrZr*r±r+Ú_is_in_profiles zSoSReport._is_in_profilecCs ||jjvSrø)r€rS©rÚ plugin_namer*r*r+Ú _is_skippedszSoSReport._is_skippedcCs*|| ¡ƒ ¡ o(||jjvo(||jjvSrø)r÷Z check_enabledr€rFrZ©rr%Z pluginClassr*r*r+Ú _is_inactive"s  ÿ þzSoSReport._is_inactivecCs*|| ¡ƒ ¡ o(||jjvo(||jjvSrø)r÷Zdefault_enabledr€rFrZr'r*r*r+Ú_is_not_default's  ÿ þzSoSReport._is_not_defaultcCs|jjo||jjvSrø)r€rZr$r*r*r+r ,s ÿzSoSReport._is_not_specifiedrìcCs"|j | ¡|| ¡ƒ|f¡dSrø)rrr"rÆr÷)rr"Úreasonr*r*r+Ú_skip0s  ýzSoSReport._skipcCs |j | ¡|| ¡ƒf¡dSrø)rqr"rÆr÷)rr"r*r*r+Ú_load7s þzSoSReport._loadc Cs tjjj}ttjjƒ}| ¡}g|_tƒ|_t |j jƒ}|j j }g}|j j r\| tjjj¡t||ƒ}|j j}t|j jƒ} |D]Ü} tj | ¡\} } zz|| |ƒ} | s¬Wq€|j  | ¡}|||j j ds|j td| ›dƒ¡|j jdkr| |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]}|| vrê|  #|¡qê| $|¡Wq€t%y\}z0|j td| ›d |›ƒ¡| &¡WYd}~q€d}~00q€t | ƒdkrœ|j 'td d (| ¡›ƒ¡| )¡| *d¡dS)N)rEzplugin z does not validate, skippingrzdoes not validateZexcludedZskippedZinactiveZoptionalr^z not specifiedz does not install, skipping: z)Unknown or inactive profile(s) provided: rrn)+ÚsosriÚpluginsÚ import_pluginrZ get_modulesÚ plugin_namesrÚr^r!r€rlZvalid_subclassesrEr"ZExperimentalPluginÚtupleÚvalidate_pluginrÙrrÇÚsplitextZ match_pluginr‚rÂr°rör+r#r&r(r)rrßr Úremover,rÅrr…rÄrNr‰)rr/rñr.Zusing_profilesZpolicy_classesZ extra_classesZvalid_plugin_classesr2Zremaining_profilesÚplugZplugbaseÚ__Zplugin_classesr"Z in_profileZdefault_profileÚiÚer*r*r+Ú load_plugins=s€        ÿÿ       ÿ   ÿ zSoSReport.load_pluginscCs<|jjr8|jD](\}}|j ¡D]}t|jvr d|_q qdS)NT)r€r7rqÚoptionsÚvaluesÚboolZval_typer«)rr6r5Úoptr*r*r+Ú_set_all_optionsŒs  zSoSReport._set_all_optionsc Cs|jjri}|jjD]Þ}z| d¡\}}WntyBd}Yn0t|tƒr’| ¡}|dvrdd}n.|dvrrd}n z t|ƒ}WntyYn0z| d¡\}}Wnty¾|}d}Yn0z ||Wntyæi||<Yn0||||<q|j D]Î\}}||vrü||D]®}||j vrH|j   d|›d|›d ¡|  d ¡z:|j | |||¡|j  d |›d |j |›¡Wn<ty¾}z"|j   |¡|  d ¡WYd}~n d}~00q||=qü|D]}|j   d |›d¡qÐ| ¡r|j   d¡dS)Nú=T)ÚonÚenableZenabledÚtrueZyes)rºÚdisableZdisabledZfalseÚnoFÚ.zno such option "z" for plugin (rmrnzSet z plugin option to zCWARNING: unable to set option for disabled or non-existing plugin (z).r)r€rJr×Ú ValueErrorÚ isinstancer¡rÁr¢ÚKeyErrorrqr:r‚r…r‰Z set_valuerƒrÅrÃ)rr€r=rÚargr5rrÊr*r*r+Ú _set_tunables“sh             ÿ  ÿÿ $ÿ zSoSReport._set_tunablescCsˆddl}| |jj|jj¡D]:}| d¡d}||jvr|j d|›d¡|  d¡q|jj D]"}||jvr`|j  d|›d¡q`dS)NrrEza non-existing plugin (z$) was specified in the command line.rnz'Requested to skip non-existing plugin 'z'.) Ú itertoolsÚchainr€rZrFr×r0r‚Úfatalr‰rSrÂ)rrKÚpluginr%r*r*r+Ú_check_for_unknown_pluginsÎs ÿ     ÿz$SoSReport._check_for_unknown_pluginscCs2|jD]&\}}|jD]}|j |j|¡qqdSrø)rqr:rsr")rr6rNr=r*r*r+Ú_set_plugin_optionsÝs zSoSReport._set_plugin_optionscCsÆd}g}|jjdkr2|d|jj›dg7}d|j_|jjsL|dg7}d|j_|jjsf|dg7}d|j_|jjr€|dg7}d |j_|jjrš|d g7}d |j_|r²|d d  |¡7}n|d 7}|d7}|S)Nz Estimate-only mode enabledrnz --threads=z overriden to 1z--build enabledTz--no-postproc enabledz--clean disabledFz--upload* options disabledz", which overrides some options: z rEz )r€Úthreadsr9rWr<rcrÄ)rrZext_msgr*r*r+Ú_set_estimate_onlyâs,     zSoSReport._set_estimate_onlycCsd|j d¡|jr:|j dt|jƒ›dt|jƒ›d¡n|j dt|jƒ›d¡|j d¡dS)Nrrz profiles, z pluginsz profiles)r®r¯rqr!r^r±r*r*r+Ú_report_profiles_and_pluginsýs ÿ z&SoSReport._report_profiles_and_pluginsc CsÔ|js |js |j tdƒ¡dS|jrr|j tdƒ¡|j d¡|jD]&\}}|j d|d›d| ¡›¡qHn|j tdƒ¡|j d¡|jrè|j tdƒ¡|j d¡|jD]0\}}}|j d|d›d|d ›d| ¡›¡q¶|j d¡|jrn|j td ƒ¡|jd d   ¡}|D]”}||}|j }|j d krx|dkrZ|j j pVt }n|dkrt|j jppt }nt }|jdkrŽ|j j }|j d|jd›d|d›d|j›¡q"|j d¡|j tdƒ¡|jD]}|jdvrü|j |jkrüqÚt|j tƒr"|j durd} nd} n|j } | dur6d } |j d|j›d|j›d›d| d›d|j›¡qÚn|j tdƒ¡|j d¡t|jƒ} |  ¡td| dd} | D]} |j d| ›¡q®| ¡dS)Nzno valid plugins foundz,The following plugins are currently enabled:rrz<20zNo plugin enabled.z-The following plugins are currently disabled:z<30z<14z4The following options are available for ALL plugins:rrnéÿÿÿÿréú cmd-timeoutÚpostprocz<25ú<15z+The following plugin options are available:)rérVrUTr@rºrEz<35zNo plugin options available.z Profiles: ©r$)rqrrr‚rMr°r®r¯Zget_descriptionrsZget_default_plugin_optsr«r€r\r r]rÆrWr?rjrGr<rNrÙr^Úsortr,rS) rrr5Z plugclassr*Ú _defaultsZ_optr=rZtmpoptr^r&r'r*r*r+rLsv  "  ÿ       *     ÿÿ  zSoSReport.list_pluginsc CsÄ|js|j tdƒ¡dS|j tdƒ¡|j d¡dd„}t|jƒ}| ¡|D]b}g}|jD]$\}}||ƒrb||jvrb|  |¡qbt |d›|dd}|D]}|j d |›¡qžqT|  ¡dS) Nzno valid profiles foundz%The following profiles are available:rcSs t|dƒS)Nr^)r)Úcr*r*r+Ú _has_profWsz*SoSReport.list_profiles.._has_profrWTrXr) r^r‚rMr°r®r¯rÙrYrqr"r,rS) rr\r^Zprofiler.rÆrNr&r'r*r*r+rNPs"   zSoSReport.list_profilescCs|jjs|j tdƒ¡dS|j tdƒ¡|j d¡|jj ¡D]¾}|sNqD|j |¡}|j dd›d|j ›¡|j dd›d|j ›¡|j r®|j dd›d|j ›¡|j j d krö|j  ¡}d d›d}t||d dd }|D]}|j |¡qä|j d¡qDdS) Nzno valid presets foundz$The following presets are available:rzname:z>14rz description:znote:rzoptions:T)r$r%)rlZpresetsr‚rMr°r®r¯rÃÚ find_presetrÆr?rYr€röÚto_argsr,)rr[rZ options_strr&r'r*r*r+rMfs(     zSoSReport.list_presetsc Csâ|j}| |¡r(|j d|›d¡dS|p2|jj}|p>|jj}z|j||||jdWn8ty}z |j d|›¡WYd}~dSd}~00|j   d¡}|j d|…|j |d d…}|j  d |›d d   |¡›d ¡dS)zÑAdd a new command line preset for the current options with the specified name. :param name: the name of the new preset :returns: True on success or False otherwise zA preset named 'z' already existsF)rÆr?rYr€zCould not add preset: NržrrzAdded preset 'z' with options rr­T) rlr]r®r…r€r?rYrfrÅrkÚindexr¯rÄ)rrÆr?rYrlr8Z arg_indexrr*r*r+rf~s"     ÿzSoSReport.add_presetc CsŽ|j}| |¡s(|j d|›d¡dSz|j|dWn<tyt}z$|j t|ƒ›d¡WYd}~dSd}~00|j d|›d¡d S) z Delete a named command line preset. :param name: the name of the preset to delete :returns: True on success or False otherwise zPreset 'z ' not foundF©rÆr­NzDeleted preset 'r»T)rlr]r®r…rgrÅr¡r¯)rrÆrlr8r*r*r+rg›s zSoSReport.del_presetc Cs¨|j ¡}|jjr|| ¡7}|jjr4|j |¡np|tdƒ7}z t |ƒWnVt yt|j  d¡|  d¡Yn0t y¢}z|  d|¡WYd}~n d}~00dS)Nz,Press ENTER to continue, or CTRL-C to quit. zExiting on user cancelé‚rn)rlZget_msgr€rDrRÚbatchr®r¯r°ÚinputÚKeyboardInterruptr…r‰rÅ)rrr8r*r*r+rb¯s      zSoSReport.batchcCsrt ¡}d}|›d}tj |j|¡}|j |›d|›d|›d¡|j d|›¡|jj |›d|dd dS) Nz!caught exception in plugin methodz-plugin-errors.txtz "rEz()"zwriting traceback to r­Úa)Úmode) r Ú format_excrrÇrÄrór‚r…rûÚ add_string)rrNÚmethodZtracerZplugin_err_logZlogpathr*r*r+r¿s zSoSReport._log_plugin_exceptionc Csð|j ¡z&|j tdƒ¡| ¡| ¡WdSty’}zJ|jt vrnt dƒt d|j ›dƒt dƒnt d|›ƒ‚WYd}~nXd}~0t yà}z8|j  d¡|j  d¡t ¡|j  |¡WYd}~n d}~00| d¡dS)Nz Setting up archive ...rrz while setting up archivezError setting up archive: z) Unexpected exception setting up archive:rn)rlZpre_workr®r¯r°Z setup_archiverýÚOSErrorÚerrnoÚfatal_fs_errorsrÚstrerrorrÅr…r Ú print_excr‰©rr8r*r*r+ÚpreworkÈs&     "zSoSReport.preworkc Csj|j tdƒ¡|jD]L\}}zš|jj |¡| t|jj|ƒ¡t   ¡}|j   d|¡|j |_ | ¡| ¡|j |j¡|jjr| ¡t   ¡}|j   d|¡|j   d||¡WqtyÐt‚YqtyD}z\|jtvr$|j d¡|j d|j›d¡|j d¡| d¡| |d ¡WYd}~qd}~0tyb| |d ¡Yq0qdS) Nz Setting up plugins ...Z setup_startZ setup_endZ setup_timerrz while setting up pluginsrnÚsetup)r®r¯r°rqr~r.r}Zset_plugin_manifestrrÚnowr{Ú add_fieldrûZadd_default_collectionsrqrurßZ _env_varsr€r`Z setup_verifyrdrjrkrlr…rmr‰rrÅ©rrr5ÚstartÚendr8r*r*r+rqás> ÿ    ÿ   zSoSReport.setupcCs.g}| dt›¡|jjd |¡dddS)zWFetch version information from all plugins and store in the report version filez sos report: r­z version.txt)Zcontentr•N)r"rrûrhrÄ)rZversionsr*r*r+Úversions ÿzSoSReport.versioncCsö|j tdƒ¡|j d¡d}g|_g|_|jD] }|d7}|j ||df¡q2ztg}t|jj ƒ$}|  |j t |jƒ¡}Wdƒn1s0Y|D]}|sž|j  d|›¡qž|j d¡Wn(tyð|j d¡t d¡Yn0dS)Nz! Running plugins. Please wait ...rrrnzUnexpected plugin task result: z Exiting on user cancel )r®r¯r°ÚpluglistÚ running_plugsrqr"rr€rQÚmapÚ_collect_pluginrÙr‚rƒrdr…rr‰)rZ plugruncountr7ÚresultsÚexecutorÚresr*r*r+Úcollect s*  ÿ"  zSoSReport.collectc Csêtdƒ}z||j|ddd}| |j|¡}|jp:d}t ¡}|j d|¡|j |dt ¡}|j d|¡|j d||¡Wn„t y d|d›d }|j   d |›d ¡|j  |¡|j |d¡|j|ddd ¡|jd d |j ¡Yn0Wdƒn1s$0Y|jjræ|j ¡} z0td| ›ƒ} t| d ¡dƒ|j|d<Wn"ty”d|j|d<Yn0t | ¡D]D} tj  !| | ¡} tj  "| ¡rØtj  #| ¡sØt$| ƒn t %| ¡q d S)zaWraps the collect_plugin() method so we can apply a timeout against the plugin as a wholernrNZ start_timerèZend_timeZrun_timezPlugin z timed outú r­T)Úwaitzdu -sB1 rÏ)&rrqZsubmitÚcollect_pluginrérrrr{rsÚresultÚFuturesTimeoutErrorr®r…r‚r¯ryr4Zset_timeout_hitr‡Z_threadsÚclearr€rDrûZ get_tmp_dirr r¢r×rxrÅrr rÇrÄrÈÚislinkrÚunlink) rrNZpoolZ_plugÚtrérurvrrõ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ƒkrR|jrRddd›dd dd „|jDƒ¡›d }|jsf|jsfd}|rv| |¡Wn¤tyŒYn’tyþ}zZ|jtvrÞ|j d|j›d¡|j d|j›d¡t d¡| |d¡WYd}~n(d}~0ty| |d¡Yn0dS)NrnFz Starting rhz<5rrWz [Running: css|] }|VqdSrør*r¼r*r*r+r¿\rÍz+SoSReport.collect_plugin..ú]zCould not remove z from plugin list, ignoring...z& from running plugin list, ignoring...rz Finishing plugins z<12css|] }|VqdSrør*r¼r*r*r+r¿urÍz Finished running pluginsr€z while collecting plugin dataz# Data collected still available at r­r)rqryr"rÅr!rÄÚ ui_progressr‚rxr4rFr‚rƒr¢r€rQrrjrkrlr®r…rmrõrr‰r) rrNÚcountrr5ZnumplugsÚ status_linerÎr8r*r*r+r‚Ssf  ÿ   ÿ  ÿ ÿ ÿ  ÿ ÿ  zSoSReport.collect_plugincCsR|jjdkr&|jjs&d| d¡›}n |›d}|jjsNtj |¡tj ¡dS)Nrú éZr­) r€rörbÚljustÚquietrr ÚwriteÚflush)rrr*r*r+r‹Šs   zSoSReport.ui_progresscCs@|js dSd dd„dd„|jDƒDƒ¡d}|j |d¡dS)Nr­cSs"g|]\}}|›dt|ƒ›‘qS)r?)r )r½rÆrr*r*r+rÌ–sz.SoSReport.collect_env_vars..cSs.g|]&}tj |¡dur|tj |¡›f‘qSrø)rÚenvironÚget)r½rÆr*r*r+r̘sÿZ environment)rurÄrûrh)rÚenvr*r*r+Úcollect_env_vars“s þüzSoSReport.collect_env_varsc Csætƒ}|jD]à\}}t|d}|jD]}| t|ƒ¡q$|jrN| t|jƒ¡|jD]"}| t |dd|dd¡qT|j D]4}| t |ddt j  d| ¡d|d ¡d ¡q~|jD]&\}}}| t|t j  d|¡d¡qº| |¡q td d ftd dftddff} | D]Ò\} } } zT| ¡} | |ƒ ¡}| dd¡ ¡}|  |¡|  ¡|jj| t j  d| ¡dWnptyÜ}zV|jtvrÈ|j  !d¡|j  !d|j"›d| ›d¡|j  !d¡| #d¡WYd}~n d}~00qdS)Nr`Zsrcpathz..Zdstpath)rÆÚhrefÚcmdrròr)rÆZ return_coder˜zsos.txtÚtextzsos.jsonZJSONzsos.htmlZHTMLúutf-8rØrÿrrrz while writing z reportrn)$rrqrZalertsÚaddrZ custom_textrZ copied_filesrZexecuted_commandsrrrÇrÄr÷Z copy_stringsrrrrrúZunicodeÚencodeÚdecoder’r“rûrrjrkrlr®r…rmr‰)rrirr5r©Zalertr‰r™r6Z formatlistÚclass_ÚfilenameÚtype_ÚfdrÏr8r*r*r+Úgenerate_reportss\     ÿ   ýÿ  ÿ  ý  ÿ   ÿ zSoSReport.generate_reportsc Cs|jD]\}}zh| d¡rdt ¡}|j d|¡| ¡t ¡}|j d|¡|j d||¡n|j d|›¡Wqt yê}zZ|j t vrÊ|j   d¡|j   d|j›d¡|j   d¡| d ¡| |d¡WYd}~qd}~0ty| |d¡Yq0qdS) NrVZpostproc_startZ postproc_endZ postproc_timezSkipping postproc for plugin rrz" while post-processing plugin datarn)rqZ get_optionrrrr{rsrVr‚r¯rjrkrlr®r…rmr‰rrÅrtr*r*r+rVÔs. ÿ   ÿ   zSoSReport.postproccCs„|sdSzXd}t |¡}t|dƒ,}| |¡}|s4q@| |¡q$Wdƒn1sT0YWntyz| ¡Yn0| ¡S)NFiÚrb)ÚhashlibrùÚopenÚreadrßrÅrZ hexdigest)rrûÚ hash_nameZ hash_sizeZdigestZ archive_fpZhashdatar*r*r+Ú_create_checksumìs   . zSoSReport._create_checksumcCsLt|d|ddd"}|r*| |d¡Wdƒn1s>0YdS)NrEÚwr›)Úencodingr­)r¦r’)rrûr¨ÚchecksumÚfpr*r*r+Ú_write_checksumýszSoSReport._write_checksumc sRd}d}d}| ¡d}|jjr¢zJ|j|j|j|j|jdœ}td|d}| |j   ¡¡|  ¡\}}d}Wn6t y }zt td|›ƒƒWYd}~n d}~00| ¡|jdurÄ|j  |jj¡| ¡|r(tj |j|j j¡} | tj | dd¡¡| tj | dd¡¡| tj | d d ¡¡|jjr:| ¡|jjr"d d lm‰d d lm} | |jƒ} tdd„|   d¡Dƒƒ|j!d<ˆt|j! "¡ƒƒ} |j# $d| ›¡t%|j! &¡dd„dddd…} d ‡fdd„| Dƒ¡}|j# $d|›¡|j# $d¡|j# $d¡|j# $d¡|j# $d¡|jj's*t (d¡}|jjsLt tdƒƒzÎz&|rb|j  )|¡|j  *|jj¡}Wn˜t+yà}zRt dƒt td|j,›d |j   ¡›ƒƒt dƒ|j-t.vrÌ| /d!¡WYd}~n6d}~0t y |jj0rú‚YWt (|¡dS0Wt (|¡n t (|¡0n”|jj1s>|jj2rJ|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¡|jGr,|jG ¡|jrNtj H|j¡rNtI|jƒdS)1NF)rlrõÚsys_tmpr:r{T)Úin_placeÚ hook_commonsz#ERROR: Unable to obfuscate report: rþrrrÿz manifest.jsonr©Úget_human_readable)ÚPathcss|]}| ¡jVqdSrø)ÚlstatÚst_size)r½r‰r*r*r+r¿:sz'SoSReport.final_work..z**/*Zsos_logs_reportszNEstimated disk space requirement for whole uncompressed sos report directory: cSs|dS)Nrnr*)Úxr*r*r+ÚArÍz&SoSReport.final_work..)ÚkeyÚreverseéz, c3s(|] \}}|›dˆ|dd›VqdS)z: r)Z precisionNr*)r½r¾Úvr²r*r+r¿BsÿzFive biggest plugins: rz>Please note the estimation is relevant to the current options.z€Be aware that the real disk space requirements might be different. A rule of thumb is to reserve at least double the estimation.é?zCreating compressed archive...rz while finalizing archive rnzQ Unable to encrypt when using --build. Encryption is only available for archives.zError moving directory: z Creating archive tarball failed.z:Error generating archive checksum after archive creation. z!Error writing checksum for file: z.tarz-obfuscated.tarrEzError moving archive file: zError moving checksum file: )rP)rŽrrkr°r±rûzUploaded archive successfullyzUpload attempt failed: zEUnable to upload archive when using --build as no archive is created.)JÚgenerate_manifest_tag_summaryr€r<rlrõr¯r{rZset_target_pathrûZget_archive_pathÚexecuterÅrr°rZadd_final_manifest_dataZcompression_typeZ_obfuscate_upload_passwordsrrÇrÄÚ_nameZobfuscate_filer‘Zadd_ui_log_to_stdoutrDÚ sos.utilitiesr³Úpathlibr´ÚsumrÉrxr;r®r¯Úsortedr#r9ÚumaskZrename_archive_rootÚfinalizerjrmrkrlr‰rƒZ encrypt_passZ encrypt_keyrÂÚbasenameZobfuscate_stringÚrenameZget_preferred_hash_namer©r®rØÚstatZdisplay_resultsrcrdrerrŽrrkr…r†r‡rˆrÈr)rrûZ directoryrPZdo_cleanr±ZcleanerZ_pathsrÊZ_dirr´Z tmpdir_pathZ_sumZ bigpluginsZbp_outZ old_umaskr8Zdir_nameZ final_dirr¬r¨Z base_archiveÚ final_nameZ archivestatZ archive_hashZ final_hashZuploaderrr*r²r+Ú final_worksFû  ( ÿ     ÿÿ ÿÿÿ         ÿÿ    þ           ÿ     ÿ ÿÿ ûû*   zSoSReport.final_workcCs|js|j tdƒ¡dSdS)Nzno valid plugins were enabledFT)rqr‚r…r°r±r*r*r+Úverify_pluginsÜszSoSReport.verify_pluginscCs|j d|j¡|j d|jr&|jjnd¡|j d|jj¡d}tdƒr~t dt   ¡›ƒ}|dd kr~|d   ¡d   d ¡}|j d ¡|jj d |¡|jj dt  d ¡¡|j d¡|j ¡D]\}}|jj ||¡qÆ|j d|jj¡|j d|jj¡|j d¡dS)zgAdd 'global' data to the manifest, that is any information that is not plugin-specific rwr[Zunsetr^rìZionicez ionice -p rÎrrÏrÐÚpriorityZio_classZnicenessr¹Zenabled_pluginsZdisabled_pluginsr.N)r~rsrwr[rÆZadd_listr€r^r r rÚgetpidr×rîr}rÍÚnicer¹r#rFrS)rZ _io_classÚ_ior¹r«r*r*r+Úadd_manifest_dataâs&ÿ   zSoSReport.add_manifest_datacs|d‡fdd„ }i‰|jjD]B}|jD] }||ƒq$|jD]}||dƒq8|jD] }||ƒqNq|j dttˆ ¡ƒƒ¡dS)acAdd a section to the manifest that contains a dict summarizing the tags that were created and assigned during this report's creation. This summary dict can be used for easier inspection of tagged items by inspection/analyzer projects such as Red Hat Insights. The format of this dict is `{tag_name: [file_list]}`. Úfilepathc s~|dD]p}||r|sqz ˆ|}Wnty<g}Yn0| t||tƒrX||n||g¡ttt|ƒƒƒˆ|<qdS)NÚtags)rHr™rGrÙrÄrÚ)Zentr¹ÚtagrÇ©Ú tag_summaryr*r+Ú compile_tagss     ÿz=SoSReport.generate_manifest_tag_summary..compile_tagsZ files_copiedrÖN)rÒ) r~r.ZcommandsÚfilesÚ collectionsrsÚdictrÄr#)rr×r5r™Z_fileZ collectionr*rÕr+r¾ûs        ÿz'SoSReport.generate_manifest_tag_summaryc Cs„|j dt›dd |j¡›d¡|jj ¡}dt›d|jj›dd |¡›d}|j |¡|j dt›dd |j ¡¡›¡dS) Nú[z:setup] executing 'sos rrÀz:setup] using 'z' preset defaults (rmz:setup] effective options now: ) r‚r¯Ú__name__rÄrkr[r€r^rÆ)rZ preset_argsrr*r*r+Ú_merge_preset_optionss ÿ  ÿ ÿzSoSReport._merge_preset_optionsc Csþz8|j | ¡¡| ¡| ¡| ¡| ¡| ¡| ¡|j j rX|  ¡t ‚|j j rl|  ¡t ‚|j j r€|  ¡t ‚|j jrš| |j j¡t ‚|j jr´| |j j¡t ‚| ¡sÀt ‚| ¡| ¡| ¡| ¡| ¡|j jsø| ¡|j js | ¡|j js| ¡n |j d¡| ¡| ¡WSt yt|j j!rV‚t" #dd¡dksp| $¡Yn|t%y¤|j &d¡| $¡| 'd¡YnLt yî}z2t" #dd¡dksÎ| $¡t( )|j*¡WYd}~n d}~00| 'd¡dS)Nz)Skipping postprocessing of collected dataZ SOS_TEST_LOGSZkeepz Exiting on user cancelrarnF)+rlZ set_commonsr÷r9r>rÝrJrOrPr€rLÚ SystemExitrNrMrfrgrÌrbrprÑrqrrVr—rUr£rWrVr®r¯rwrËrjrƒrÚgetenvZcleanuprdr…r‰rÚexitÚcoderor*r*r+r¿*sl        " zSoSReport.execute)N)NN)rì)rr)JrÜÚ __module__Ú __qualname__Ú__doc__r?Z root_requiredr Z arg_defaultsrpÚ classmethodr¥r¬ryrŒrŠrµr´r‹r¶r·ràrárârÛr¸r÷rúrýrrzÚ staticmethodrrrr#r&r(r)r r+r,r9r>rJrOrPrRrSrLrNrMrfrgrbrrprqrwrr{r‚r‹r—r£rVr©r®rËrÌrÑr¾rÝr¿Ú __classcell__r*r*r‘r+r3Rs ÂA ' N 6   2     O; I   17  7Z r3)Fr)7rr rrkr†r¥rrrÉÚconcurrent.futuresrrr„ÚshutilrZsos.report.pluginsr-rÁrrrr r r r r rr°rZ sos.componentrZ sos.policiesZsos.report.reportingrrrrrrrrrrZ sos.cleanerrZ sos.uploadrÚENOSPCZEROFSrlr,r/r„rtr3r*r*r*r+Ú s4    (   0