HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/lib/python3.9/site-packages/sos/help/__pycache__/__init__.cpython-39.pyc
a

^��c�*�@s�ddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
mZddlmZzee��jd�ZWney�dZYn0Gd	d
�d
e�ZGdd�d�ZdS)
�N)�OrderedDict)�SoSComponent)�
import_policy)�Plugin)�bold�ImporterHelper)�fill�xcs�eZdZdZdZdZdZdZddiZ�fdd�Z	e
dd	��Zd
d�Zdd
�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Z�ZS)�	SoSHelperz�Provide better, more in-depth help for specific parts of sos than is
    provided in either standard --help output or in manpages.
    zDetailed help infomationF�topic�cs"tt|��|||�|jj|_dS)N)�superr
�__init__�optsr)�self�parser�argsZcmdline��	__class__��5/usr/lib/python3.9/site-packages/sos/help/__init__.pyr+szSoSHelper.__init__cCs*d|_|�dd�}|jdddddd	�dS)
Nzsos help TOPIC [options]zHelp Information Optionsz<These options control what detailed information is displayedrZTOPICr�?z/name of the topic or component to show help for)�metavar�default�nargs�help)�usage�add_argument_group�add_argument)�clsrZhelp_grprrr�add_parser_options/s��zSoSHelper.add_parser_optionscCsB|jj�d�d}dddd�}||vr>|jj�|||�|j_dS)N�.r�cleaner�	collector)�clean�mask�collect)rr�split�replace)rZ_com�_replacerrr�sanitize_topic_component:s�z"SoSHelper.sanitize_topic_componentc
Cs�|jjs|��t�d�|��z|��}WnBtyp}z*td|jj|f�t�d�WYd}~n
d}~00|r�zt	�}|�
|�|��Wq�ty�}ztd|�WYd}~q�d}~00ntd|jj�dS)Nrz Could not load help for '%s': %s�zError loading help: %szNo help section found for '%s')rr�display_self_help�sys�exitr*�get_obj_for_topic�	Exception�print�HelpSectionZdisplay_help�display)r�klass�errZhtrrr�executeDs"
 
$zSoSHelper.executecCs�dddddddd�}d	}|jj|vrJt�d
|jj�}t|||jj�}n<|j|j|j|jd�}|D] }|jj�	|�rd||�}q�qd|S)z�Based on the help topic we're after, try to smartly decide which
        object we need to manipulate in order to get help information.
        Z	SoSReportrZ
SoSCleaner�SoSCollectorZRemoteTransportZClusterZPolicy)�report�report.pluginsr"r#zcollector.transportszcollector.clusters�policiesN�sos.)zreport.plugins.z	policies.zcollector.transports.zcollector.clusters.)
rr�	importlib�
import_module�getattr�_get_plugin_variant�_get_policy_by_name�_get_collect_transport�_get_collect_cluster�
startswith)rZ
static_mapr�modZ_helpZ_secrrrr/\s,�
�
zSoSHelper.get_obj_for_topiccCs2ddlm}|jj�d�d}||vr.||SdS)Nr)�
TRANSPORTSr!���)Zsos.collector.sosnoderErrr')rrEZ
_transportrrrrA|sz SoSHelper._get_collect_transportcCsXddlm}ddl}|�|jjd�}|D]*}|d|jj�d�dkr(|dSq(dS)Nr)r7�clustersr!rFr+)	Z
sos.collectorr7Zsos.collector.clustersZ
_load_modulesr#rGrrr')rr7�sosrGZclusterrrrrB�s
�zSoSHelper._get_collect_clustercCsdt�d|jj�}|��t�|tj�}dd�|D�}|D]$}|��r:|j	�
|���}|Sq:dS)Nr;cSs"g|]}t|dt�r|d�qS)r+)�
issubclassr)�.0�mrrr�
<listcomp>��z1SoSHelper._get_plugin_variant.<locals>.<listcomp>)r<r=rrZload_local_policy�inspectZ
getmembersZisclass�__subclasses__�policyZmatch_plugin)rrDZmemsZpluginsZpluginrrrrr?�szSoSHelper._get_plugin_variantcCsl|jj�d�d}ddl}t|jj�}|��D]8}t|�D]*}|j	�
��dd�}||kr:|Sq:q.dS)Nr!rFrrPr)rrr'Zsos.policies.distrosrr:ZdistrosZget_modulesr�__name__�lowerr()rZ_topicrHZ_helperrDrPZ_prrrr@�szSoSHelper._get_policy_by_namecCs�tdd�}|�dtd��|�d�}td�}|�d|�td�}|�d	|�|�d
�}|�d�dd
ddddd�}|D]"}|jd�t|�||�dd�q||��dS)zhDisplays the help information for this component directly, that is
        help for `sos help`.
        zDetailed help for sos helpz�The 'help' sub-command is used to provide more detailed information on different sub-commands available to sos as well as different components at play within those sub-commands.ahSoS - officially pronounced "ess-oh-ess" - is a diagnostic and supportability utility used by several Linux distributions as an easy-to-use tool for standardized data collection. The most known component of which is %s (formerly sosreport) which is used to collect troubleshooting information into an archive for review by sysadmins or technical support teams.z
sos reportzHow to search using sos helpz$component.$topic.$subtopicz<To get more information on a given topic, use the form '%s'.zsos help report.plugins.kernelz\For example '%s' will provide more information on the kernel plugin for the report function.zAvailable Help Sectionsz�The following help sections are available. Additional help topics and subtopics may be displayed within their respective help section.
z#Detailed help on the report commandz'Information on the plugin design of sosz!Information on a specific $pluginz"Detailed help on the clean commandz$Detailed help on the collect commandz+How sos operates on different distributions)r8r9zreport.plugins.$pluginr$r&r:z		{:<36}{}F)�newlineN)r2�add_textr�add_section�formatr3)rZ	self_helpZsubsectrZrep_exZ
avail_help�sectionsZsectrrrr,�sJ���

���
��	�zSoSHelper.display_self_help)rQ�
__module__�__qualname__�__doc__ZdescZconfigure_loggingZload_policyZ
load_probeZarg_defaultsr�classmethodr r*r6r/rArBr?r@r,�
__classcell__rrrrr
s$�


 	
r
c@sHeZdZdZddd�Zdd�Zddd	�Zdd
d�Zddd
�Zdd�Z	dS)r2z�This class is used to build the output displayed by `sos help` in a
    standard fashion that provides easy formatting controls.
    rcCs||_||_||_t�|_dS)a�
        :param title:   The title of the output section, will be prominently
                        displayed
        :type title:    ``str``

        :param content: The text content to be displayed with this section
        :type content:  ``str``

        :param indent:  If the section should be nested, set this to a multiple
                        of 4.
        :type indent:   ``int``
        N)�title�content�indentrrW�rr]r^r_rrrr�s
zHelpSection.__init__cCs
||_dS)z�Set or override the title for this help section

        :param title:   The name to set for this help section
        :type title:    ``str``
        N)r])rr]rrr�	set_title�szHelpSection.set_titleTcCs,|jr|rdnd}||}|j|7_dS)z�Add body text to this section. If content for this section already
        exists, append the new ``content`` after a newline.

        :param content:     The text to add to the section
        :type content:      ``str``
        z

�
N)r^)rr^rS�lnrrrrT�szHelpSection.add_textcCs|�|||�|j|S)acAdd a section of text to the help section that will be displayed
        when the HelpSection object is printed.

        Sections will be printed *in the order added*.

        This will return a subsection object with which block(s) of text may be
        added to the subsection associated with ``title``.

        :param title:   The title of the subsection being added
        :type title:    ``str``

        :param content: The text the new section should contain
        :type content:  ``str``

        :returns:   The newly created subsection for ``title``
        :rtype:     ``HelpSection``
        )�_add_sectionrWr`rrrrUszHelpSection.add_sectioncCs(||jvrtd��t|||�|j|<dS)z�Internal method used to add a new subsection to this help output

        :param title:   The title of the subsection being added
        :type title:    ``str`
        z(A section with that title already existsN)rWr0r2r`rrrrds
zHelpSection._add_sectioncCsdttt|j�t|jd��|j��D]}tt|t|jd��q$|jD]}td�|j|�	�qDdS)zWPrint the HelpSection contents, including any subsections, to
        console.
        )�width�initial_indentrN)
r1rrr]�TERMSIZEr_r^�
splitlinesrWr3)rrc�sectionrrrr3#s�
zHelpSection.displayN)rrr)T)rr)rr)
rQrXrYrZrrarTrUrdr3rrrrr2�s




r2)rNr<r-�os�collectionsrZ
sos.componentrZsos.policiesrZsos.report.pluginsrZ
sos.utilitiesrr�textwrapr�min�get_terminal_size�columnsrgr0r
r2rrrr�<module>s 
=