a Ü““iLšã@sÎddlZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZmZmZmZdd lmZeeeee d œZGd d„dƒZdS)éN)Úquote)Úload)Ú InitSystem)ÚJujuSSH)ÚSSHControlPersist)ÚLocalTransport)Ú OCTransport)ÚSaltStackMaster)ÚCommandTimeoutExceptionÚConnectionExceptionÚUnsupportedHostExceptionÚInvalidTransportException)Úsos_parse_version)ÚlocalZcontrol_persistÚocZ saltstackZjujuc@s´eZdZdjdd„Zedd„ƒZdd„Zd d „Zd d „Zed d„ƒZ edd„ƒZ dd„Z dd„Z dd„Z dd„Zdkdd„Zedd„ƒZdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zdld0d1„Zd2d3„Zd4d5„Zd6d7„Zd8d9„Zdmdd?„Z d@dA„Z!dBdC„Z"dDdE„Z#dFdG„Z$dHdI„Z%dJdK„Z&dLdM„Z'dNdO„Z(dPdQ„Z)dRdS„Z*dTdU„Z+dVdW„Z,dXdY„Z-dZd[„Z.d\d]„Z/d^d_„Z0d`da„Z1dbdc„Z2ddde„Z3dfdg„Z4dhdi„Z5dS)nÚSosNodeNTc Cs| ¡|_||_|d|_| ¡|d|_|d|_|d|_|d|_|jj |_ |jj |_ d|_ d|_ d|_ d|_i|_i|_|pŒ|jj|_|jjsª|jjsª|j|j_|r¶||j_d|_d|_d|_g|_dgggg|ddœ|_d |_t d ¡|_t d ¡|_| |¡|_ |j j!�r(|j j!d k|_z|j  "|j¡Wn8t#�yr}z| $d |›�¡‚WYd}~n d}~00| %¡|_ d|_&|j j|_|j �r¤|jj'�r¤d}|j(�rü|�rü|j �sÈ|j  )¡dS|j �râ| *¡�râd|j _+|j j+�rô| ,¡| -¡dS)NZ cmdlineoptsÚtmpdirÚhostlenÚ need_sudoÚ sos_optionsFÚsos_cmd)ÚversionÚenabledÚdisabledÚoptionsÚpresetsrÚ sosreportZsosZsos_uiÚrootzUnable to open remote session: ).ÚstripÚaddressÚcommonsÚoptsÚ_assign_config_optsrrrrÚnode_config_fileÚinherit_config_filerÚhostÚclusterÚhostnameÚ sos_env_varsÚ _env_varsÚpasswordÚ _passwordZ nopasswd_sudoZsudo_pwÚsos_pathÚ retrievedZhash_retrievedÚ file_listÚsos_infoÚsos_binÚloggingZ getLoggerÚsoslogÚui_logÚ_load_remote_transportÚ _transportZ default_userZconnectÚ ExceptionÚ log_errorÚdetermine_host_policyÚ _sudo_binaryZno_localÚ connectedÚ disconnectÚcheck_in_containerÚ containerizedÚcreate_sos_containerÚ_load_sos_info)Úselfrr r*Z local_sudoZ load_factsÚerr©rBú9/usr/lib/python3.9/site-packages/sos/collector/sosnode.pyÚ__init__,sv         ú         zSosNode.__init__cCs|jr|jjSdS)NT)r5r:©r@rBrBrCr:rszSosNode.connectedcCs|j ¡dS)zDWrapper to close the remote session via our transport agent N)r5r;rErBrBrCr;yszSosNode.disconnectcCst|jdvrd|_t|j|ƒS|jjtvr| d¡}|d|j|d<q>|jS)Nz env --nullÚstatusrÚoutputúú=rK)r)rÚosÚenvironÚcopyÚ run_commandÚsplit)r@ÚretZlnÚ_valrBrBrCÚenv_vars’s   zSosNode.env_varscCsl|jsf|jj d¡d}| d|›�¡}rT|ddksTd|›�}| |¡t|ƒ‚|dkr`d}||_|jS) Nú/éÿÿÿÿz command -v rPrz*Privilege escalation command not in PATH: Úsudozsudo -S)r9r!Ú sudo_binaryrXrWr7r6)r@Z_binrYrArBrBrCr_¡s   zSosNode.sudo_binarycCs`||_|j d|j¡|j d|jj¡|j d|jd¡|j dd¡|j d|jj¡dS) z>Set the manifest section that this node will write to r'ÚpolicyZ sos_versionrÚfinal_sos_commandÚrHN)ÚmanifestÚ add_fieldrLr%Úos_release_namer/r5Úname)r@rcrBrBrCÚset_node_manifest°s zSosNode.set_node_manifestcCs<tj d¡r| d¡dStj d¡dur8| d¡dSdS)zV Tries to identify if we are currently running in a container or not. z/run/.containerenvz/Found /run/.containerenv. Running in container.TÚ containerNz/Found env var 'container'. Running in containerF)rTÚpathÚexistsÚ log_debugrUÚgetrErBrBrCr<ºs   zSosNode.check_in_containercCsî|jjrê|jj|jj| ¡|jjd�}|j|dd�}|ddvrÒ|ddkr€d|dvrf| d ¡t ‚d |dvr€| d ¡t ‚|j|j  ¡dd�}|dd krº|  d |jj ›d�¡dS| d|d›�¡t ‚| d|d›�¡t ‚dS)zJIf the host is containerized, create the container we'll be using )ÚimageZauthZ force_pullT©Ú need_rootrP)ré}rpzunable to retrieve auth tokenrQzHCould not pull image. Provide either a username and password or authfilezunknown: Not foundz%Specified image not found on registryrzTemporary container z createdz(Could not start container after create: z$Could not create container on host: F) r%r=r>r!rmÚget_container_authZforce_pull_imagerWr7r6Zrestart_sos_containerÚlog_infoZsos_container_name)r@ÚcmdÚresrYrBrBrCr>ÆsDý   ÿ   ÿ ÿ ÿÿzSosNode.create_sos_containercCsB|jjr$|jjd |jj|jj¡S|jjd |jjp>|jj¡S)zrDetermine what the auth string should be to pull the image used to deploy our temporary container Údefault) r!Z registry_userr%ZruntimesZfmt_registry_credentialsZregistry_passwordZfmt_registry_authfileZregistry_authfileZcontainer_authfilerErBrBrCrqîs þ ÿzSosNode.get_container_authFcCs<z"|jd|›�|d�}|ddkWSty6YdS0dS)z3Checks for the presence of fname on the remote nodezstat rnrPrFN)rWr6)r@ÚfnamerortrBrBrCÚ file_existsûs  zSosNode.file_existscCs|jrd|jvr|jS|jS)NrF)r'rrErBrBrCrLszSosNode._hostnamecCsd}t |d|¡S)zUAttempts to obfuscate sensitive information in log messages such as passwordsz>(?P(pass|key|secret|PASS|KEY|SECRET).*?=)(?P.*?\s)z\g****** )ÚreÚsub)r@rNZregrBrBrCÚ_sanitize_log_msg szSosNode._sanitize_log_msgcCs|j | |¡¡dS)z:Format a ui message that includes host name and formattingN)r3ÚinforOrMrBrBrCÚui_msgszSosNode.ui_msgcCs8t ¡dd}d|j›d|›d|›�}|j |¡dS)z#Used to print and log info messagesrKéú[ú:ú] N)ÚinspectÚstackrLr2r{©r@rNÚcallerZlmsgrBrBrCrrszSosNode.log_infocCs8t ¡dd}d|j›d|›d|›�}|j |¡dS)z$Used to print and log error messagesrKr}r~rr€N)r�r‚rLr2ÚerrorrƒrBrBrCr7szSosNode.log_errorcCsB| |¡}t ¡dd}d|j›d|›d|›�}|j |¡dS)z$Used to print and log debug messagesrKr}r~rr€N)rzr�r‚rLr2Údebug)r@rNr„rBrBrCrks zSosNode.log_debugcCsX|j dtj d¡¡dk}|jr(|r(|S|jjr>dt|ƒ›�S|jrT|j ›d|›�S|S)z‚If we need to provide a sudo or root password to a command, then here we prefix the command with the correct bits ZUSERrzsu -c ú ) r)rlrTrUrr!Ú become_rootrrr_)r@rsZis_rootrBrBrCÚ _format_cmd&s zSosNode._format_cmdc Csªd}d}|jjdurN|jj |jj¡}|dur†d |d¡}|dr†|d}n8|j|jjddd�}|ddkr†|d  ¡ d ¡\}}}|röt | d¡ƒd kr¤|d 7}z|d | d¡d›�7}Wn4t yô}z|  d |›�¡WYd}~n d}~00||j d<|j d�r$|  d|j d›�¡n$|j|jjk�s>| d¡d|_dS| d¡�rZd|_|j›d�}|j|ddd�}|ddk�r’| |d ¡| d¡�r¦| ¡dS)zLQueries the node for information about the installed version of sos NÚ.rÚreleaseT©Ú use_containerrorPrrQú-éz.0z#Unable to fully parse sos release: zsos version is z!sos is not installed on this nodeFz4.0z sos reportz -lú3.6)r%Zcontainer_version_commandÚpackage_managerZ pkg_versionZ sos_pkg_nameÚjoinrWrrXÚlenr6rkr/rrrr!Zprimaryr7r:Úcheck_sos_versionr0Ú_load_sos_pluginsÚ_load_sos_presets) r@ÚverÚrelÚpkgZpkgsÚ_rArsÚsosinforBrBrCr?3sH   ÿ &      zSosNode._load_sos_infocCsn|j›d�}|j|ddd�}|ddkrj|d ¡D]4}| ¡ d¡r4| d¡d ¡}|jd  |¡q4dS) Nz --list-presetsTrŒrPrrQzname:rKr)r0rWÚ splitlinesrÚ startswithrXr/Úappend)r@rsrtÚlineZpnamerBrBrCr–gs  zSosNode._load_sos_presetsc Cs’d}d}d}d}d}|d|}|d|}|d|} |dd} | ||¡|jd<| ||¡|jd <| | |¡|jd <| | |d ¡|jd <dS) Nz,The following plugins are currently enabled:z-The following plugins are currently disabled:z4The following options are available for ALL plugins:z+The following plugin options are available:z Profiles:z(.*?)z rrrTZprofiles)Ú_regex_sos_helpr/) r@r›ZENABLEDZDISABLEDZ ALL_OPTIONSZOPTIONSZPROFILESZ enableregZdisregZoptregZproregrBrBrCr•ps    zSosNode._load_sos_pluginsc Cs¤g}t ||tj¡D]Š}| ¡D]|}|s~z| ¡}rD| |d¡Wqœtyz}z| d|›�¡WYd}~qœd}~00q | d¡} | dd„| Dƒ¡q q|S)NrzError parsing sos help: ú,css|]}| ¡r| ¡VqdS©N)r)Ú.0ÚprBrBrCÚ �óz*SosNode._regex_sos_help..) rxÚfindallÚSrœrXržr6rkÚextend) r@Zregexr›Zis_listrtÚresultrŸZlsrAÚrrBrBrCr �s  ( zSosNode._regex_sos_helpc Cs`z| d|›�¡|j |¡WStyZ}z$| d|›d|›�¡WYd}~dSd}~00dS)z1Reads the specified file and returns the contentsz Reading file zException while reading ú: Nrb)rrr5Ú read_filer6r7)r@Zto_readrArBrBrCr­�s zSosNode.read_filec Csz|jr(| d|jdj›�¡|jdSti|jjtƒd|jj |  d¡d�}|rh| d|j›d�¡|S|  d¡t ‚d S) z[Attempts to identify the host installation against supported distributions zusing local policy r`Tz/etc/os-release)ÚcacheÚsysrootÚinitZ probe_runtimeZ remote_execZ remote_checkzloaded policy z for hostz4Unable to determine host installation. Ignoring nodeN) rrrr rerr!r¯rr5rWr­r7r )r@r%rBrBrCr8™sÿ ý zSosNode.determine_host_policyc CsXz|jd}t|ƒt|ƒkWStyR}z| d|›�¡WYd}~dSd}~00dS)a�Checks to see if the sos installation on the node is AT LEAST the given ver. This means that if the installed version is greater than ver, this will still return True :param ver: Version number we are trying to verify is installed :type ver: ``str`` :returns: True if installed version is at least ``ver``, else False :rtype: ``bool`` rzError checking sos version: NF)r/rr6r7)r@r—Z _node_verrArBrBrCr”«s  zSosNode.check_sos_versioncCs|js dS|jj |¡duS)z2Checks if a given package is installed on the nodeFN)r%r‘Z pkg_by_name)r@r™rBrBrCÚ is_installed½szSosNode.is_installedé´rGc CsÀ|jsr|jsr| d¡z$|j |j¡}|s8| d¡t‚Wn6typ}z| d|›�¡‚WYd}~n d}~00|rŠ|jj rŠ|j  |¡}|r˜|  |¡}|r¬|j } |   |¡}|j |||||¡S)a™Runs a given cmd, either via the SSH session or locally :param cmd: The full command to be run :type cmd: ``str`` :param timeout: Time in seconds to wait for `cmd` to complete :type timeout: ``int`` :param use_shell: If a shell is needed to run `cmd`, set to True :type use_shell: ``bool`` or ``auto`` for transport-determined :param use_container: Run this command in a container *IF* the host is a containerized host :type use_container: ``bool`` :param env: Pass environment variables to set for this `cmd` :type env: ``dict`` z-Node is disconnected, attempting to reconnectzFailed to reconnect to nodez!Error while trying to reconnect: N)r:rrkr5Z reconnectr+r r6r%r=Zformat_container_commandr‰r[ÚupdaterW) r@rsÚtimeoutÚ use_shellror�ÚenvZ reconnectedrAZ_cmd_envrBrBrCrWÃs(       ÿzSosNode.run_commandc Csxz6| ¡}|r| |¡n | d¡|jr4| ¡|_Wn4tyj}z| d|›�¡WYd}~n d}~00| ¡dS)z.Run an sos report on the node, then collect itz'Unable to determine path of sos archivezError during sos execution: N)Úexecute_sos_commandÚfinalize_sos_pathr7r,Úretrieve_sosreportr-r6Úcleanup)r@rirArBrBrCrës  &zSosNode.sosreportcCs||jdvS)z/Verifies if the given preset exists on the noder©r/)r@ÚpresetrBrBrCÚ_preset_existsùszSosNode._preset_existscs&t‡fdd„|jd|jdfDƒƒS)z/Verifies if the given plugin exists on the nodec3s|]}ˆ|vVqdSr¢rB)r£Ús©ÚpluginrBrCr¥ÿr¦z)SosNode._plugin_exists..rr)Úanyr/©r@rÀrBr¿rCÚ_plugin_existsýsÿzSosNode._plugin_existscCs||jdvS)z6Checks to see if the plugin is default enabled on noderr»rÂrBrBrCÚ_check_enabledszSosNode._check_enabledcCs||jdvS)z7Checks to see if the plugin is default disabled on noderr»rÂrBrBrCÚ_check_disabledszSosNode._check_disabledcCsR| d¡d}| |¡sdS| |¡r6||jjvr6dS| |¡rN||jdvSdS)z÷Attempts to verify that the given option is available on the node. Note that we only get available options for enabled plugins, so if a plugin has been force-enabled we cannot validate if the plugin option is correct or notrŠrFrT)rXrÃrÅr!Úenable_pluginsrÄr/)r@ÚoptÚplugrBrBrCÚ_plugin_option_exists s   ÿ zSosNode._plugin_option_existscsd ‡fdd„|Dƒ¡S)z^Returns a comma delimited list for sos plugins that are confirmed to exist on the noder¡c3s|]}ˆ |¡r|VqdSr¢©rér£ÚorErBrCr¥r¦z,SosNode._fmt_sos_opt_list..)r’)r@r!rBrErCÚ_fmt_sos_opt_listszSosNode._fmt_sos_opt_listcCs ||_dS)zVExpose the node to the cluster profile determined for the environment N)r&)r@r&rBrBrCÚ set_cluster szSosNode.set_clustercs^|jjr0|js|jj|_n| d|jj›d�¡|jjr\|jjD]}||jvr@|j |¡q@|jjrŽ|jjD] ‰ˆ|jvrl|jjˆ|jˆ<ql|jjrÞ|jjD]>‰t ‡fdd„|j Dƒƒsžˆ›d|jjˆ›�}|j  |¡qž|j  |¡�r$|jj �|j  |¡Wdƒn1�s0Yn6|jj �|j |¡Wdƒn1�sP0YdS)a+This is used to modify the sos report command run on the nodes. By default, sos report is run without any options, using this will allow the profile to specify what plugins to run or not and what options to use. This will NOT override user supplied options. zCluster specified preset z> but user has also defined a preset. Using user specification.c3s|]}ˆ|vVqdSr¢rBrË©rÇrBrCr¥Br¦z2SosNode.update_cmd_from_cluster..rSN)r&Z sos_presetr¼rrZ sos_pluginsrÆržrZsos_plugin_optionsrÁÚplugoptsZcheck_node_is_primaryÚlockZset_primary_optionsZset_node_options)r@rÈÚoptionrBrÏrCÚupdate_cmd_from_cluster&s0 ÿ       . zSosNode.update_cmd_from_clustercCsJt|jjƒ|_t|jjƒ|_t|jjƒ|_t|jjƒ|_t|jjƒ|_dS)zˆFrom the global opts configuration, assign those values locally to this node so that they may be acted on individually. N)Úlistr!Ú only_pluginsÚ skip_pluginsrÆrÐr¼rErBrBrCr"Ns zSosNode._assign_config_optscsÒˆjd}ˆ ¡}|r*|›dt|ƒ›d�}g}ˆ d¡r`ˆjjdkr`| dttˆjjƒƒ›�¡ˆ d¡rŽˆjjrŽ| dttˆjjƒƒ›�¡ˆ d¡r܈jj rª| d ¡ˆjj r¼| d ¡ˆjj rÜ| d tˆjj ƒ›�¡ˆ d ¡�r8ˆjj �r| d td  ˆjj ¡ƒ›�¡ˆjj�r8| dtd  ˆjj¡ƒ›�¡ˆ d¡�rjˆjj�rj| dttˆjjƒƒ›�¡ˆ d¡�s‚ˆ d¡�rˆjjdk�r¤| dˆjj›�¡ˆjj�rÂ| dˆjj›�¡ˆ d¡�rˆjj�rì| dˆjj›�¡ˆjj�r| d¡ˆ ¡| dtj  ˆjjˆj¡¡}ˆjD]0}ˆj|}| d|›d|�rN|nd›�¡�q*ˆj�r¢‡fdd„ˆjDƒ}|�r¢| dtd  d d!„|Dƒ¡ƒ›�¡ˆj�r䈠ˆj¡�rÐ| d"tˆjƒ›�¡nˆ d#ˆj›d$�¡ˆj �rž‡fd%d„ˆj Dƒ}t!|ƒt!ˆj ƒk�r¦sþz,SosNode.finalize_sos_cmd..z-k css|] }|VqdSr¢rBrËrBrBrCr¥ªr¦z+SosNode.finalize_sos_cmd..z --preset=zRequested to enable preset z" but preset does not exist on nodecsg|]}ˆ |¡r|‘qSrBrÊrËrErBrCrØ´r¦zRequested plugins z. were requested to be enabled but do not existz--only-plugins=zFinal sos command set to raNcsg|]}ˆ |¡r|‘qSrB)rÄrËrErBrCrØÃr¦zRequested to skip plugins z%, but plugins are already not enabledz--skip-plugins=cs.g|]&}|ˆjvrˆ |¡rˆ |¡r|‘qSrB)rÖrÅrÃrËrErBrCrØÎs þzRequested to enable plugins z1, but plugins are already enabled or do not existz--enable-plugins=)+r/Údetermine_sos_labelrr”r!ÚthreadsržÚstrZplugin_timeoutZallow_system_changesZ no_env_varsZsinceZ skip_commandsr’Z skip_filesZ cmd_timeoutZcontainer_runtimeZ namespacesZ journal_sizeZ low_priorityrÓÚreplacerTrir%Z sos_bin_pathr0rrÐr¼r½rkrÕr“rÔÚsetrÍrrrrcrdrÖrÆ)r@rÚlabelZsos_optsrÇrZr!ZplugsZnot_onlyZonlyÚskipZnot_skipZskiplnZnot_onÚenablerBrErCÚfinalize_sos_cmdYs¾    ÿ     ÿ ÿ  ÿ ÿ  ÿ    þ  $$   zSosNode.finalize_sos_cmdcCs�d}||j |¡7}|jjr<||s,|jj›n d|jj›�7}|sDdS| d|›�¡| d¡rdd}nd}|j d¡d ›d|›�}|›d |›�S) z?Determine what, if any, label should be added to the sos reportrbrŽNzLabel for sos report set to r�z--labelz--namerŠrrS)r&Zget_node_labelr!rÞrkr”rrX)r@rÞZlcmdrBrBrCrÙÝs ÿ zSosNode.determine_sos_labelcCs^|jj}|r| |d¡}| ¡d}| d|›�¡||_| d¡d|_|j d|j¡dS)z\Use host facts to determine if we need to change the sos path we are retrieving fromrbrzFinal sos path: r\r]Zcollected_archiveN) r%Zsos_path_striprÜrXrrr,Úarchivercrd)r@riZpstriprBrBrCr¸ñs  zSosNode.finalize_sos_pathcCsT|dkr dS|dkr d|vr dS|dkr,dSt|ƒdkrJ| d ¡dd…Sd |›�S) Nr]z+sos report process received SIGKILL on noderKr^zsudo attempt failedéz4sos report terminated unexpectedly. Check disk spacerÚ zsos exited with code )r“rX)r@ÚrcÚstdoutrBrBrCÚdetermine_sos_errorýs zSosNode.determine_sos_errorc Cs8| d¡�zÀd}d}d}|jjr2d|jj›�}nR|jjr„|jsvd|j d¡d›d�}|j |jj |¡d|›�}nd|jj ›�}|rš|j ›d |›�|_ |j |j |jj d d d |j d �}|d d k�rŽ|d ¡D]J}t |d¡rê| ¡}| d¡�r| d¡d}qÒ| d¡rÒ| ¡d}qÒ|�r~|j d|¡t|ƒdk�rP|j dd¡n,t|ƒdk�rn|j dd¡n|j dd¡n|j dd¡n:| |d |d¡}| d|d ›d|d›�¡t|ƒ‚|WSt�yì| d¡‚YnHt�y2}z.| d|›�¡| d |›�¡‚WYd!}~n d!}~00d!S)"z2Run sos report and capture the resulting file pathzGenerating sos report...Frbz--config-file=z/tmp/r\r]z.confr‡T)r´rµror�r¶rPrrQz*sosreport-*tar*)z sha256 z md5 ú rKzThe checksum is: r}Úchecksumé Z checksum_typeZmd5é@Zsha256ÚunknownzError running sos report. rc = z msg = zTimeout exceededz'Exception during sos report execution: zError running sos report: N)r|r!r#r$rrrXr5Zcopy_file_to_remoteZ config_filerrWr´r(rœÚfnmatchrr�rcrdr“rçrkr6r r7rr)r@riréZconfig_file_argZ remote_configrtrŸrArBrBrCr· sr þ  ÿû   ÿÿ zSosNode.execute_sos_commandc Cs¬|jd}tj || d¡d¡}zH| |¡rT| d|›d|›�¡|j ||¡WS|  d|›d�¡WdSt y¦}z$|  d|›d |›�¡WYd }~dSd }~00d S) z7Copies the specified file from the host to our temp dirr\r]zCopying remote z to local zAttempting to copy remote file ú%, but it does not exist on filesystemFzFailed to retrieve r¬N) rrTrir’rXrwrrr5Ú retrieve_filerkr6)r@riZdestdirÚdestrArBrBrCrïEs  zSosNode.retrieve_filec CsÒd | ¡¡}z‚t| d¡ƒdkr:| d|›d�¡WdS| |¡rz| d|›�¡d|›�}|j|d d �}|d d kWS| d |›d�¡WdStyÌ}z$| d|›d|›�¡WYd}~dSd}~00dS)z|Removes the spciefied file from the host. This should only be used after we have retrieved the file already rbr\r�zRefusing to remove path z0: appears to be incorrect and possibly dangerousFzRemoving file zrm -f TrnrPrz!Attempting to remove remote file rîzFailed to remove r¬N)r’rXr“rkrwrrrWr6)r@rirsrtÚerBrBrCÚ remove_fileTs  zSosNode.remove_filec CsÔ|js|jjr>z| |j¡Wnty<| d¡YdS0| d|j›�¡|  d¡z|  |j¡}Wn0tyš}z| |¡WYd}~dSd}~00|rÆ|  d¡|j   |j  d¡d¡d S|  d ¡dS) z,Collect the sos report archive from the nodezFailed to make archive readableFzRetrieving sos report from zRetrieving sos report...Nz!Successfully collected sos reportr\r]TzFailed to retrieve sos report)rr!rˆÚmake_archive_readabler,r6r7rrrr|rïr.ržrX)r@rYrArBrBrCr¹js&      zSosNode.retrieve_sosreportcCsT|jdus|jrdSd|jvr6| d|j›d�¡dS| |j¡}|sP| d¡dS)zvRemove the sos report archive from the node, since we have collected it and it would be wasted space otherwiseNrzNode sos report path z/ looks incorrect. Not attempting to remove pathzFailed to remove sos report)r,rrkròr7)r@ZremovedrBrBrCÚremove_sos_archive€s  zSosNode.remove_sos_archivecCsL| ¡|jr,dD]}| |j|¡rq,q|j ¡}|rH|j|dd�dS)zrqrwrLrzr|rrr7rkr‰r?r–r•r r­r8r”r±rWrr½rÃrÄrÅrÉrÍrÎrÓr"rárÙr¸rçr·rïròr¹rôrºrørórBrBrBrCr*svÿ F     (   4   ÿ ((   < r)rír�r1rTrxZshlexrZ sos.policiesrZsos.policies.init_systemsrZsos.collector.transports.jujurZ(sos.collector.transports.control_persistrZsos.collector.transports.localrZsos.collector.transports.ocrZ"sos.collector.transports.saltstackr Zsos.collector.exceptionsr r r r Z sos.utilitiesrrIrrBrBrBrCÚ s*         û