????

Your IP : 216.73.216.152


Current Path : /proc/self/root/lib/python2.7/site-packages/sos/policies/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/sos/policies/__init__.pyo

�
Dr^c
@�sddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZm
Z
mZmZddlmZmZddlmZddlmZmZddlmZddlmZdd	lmZd
Zd�Zie d�Z!d
e"fd��YZ#de#fd��YZ$de"fd��YZ%dZ&dZ'dZ(de"fd��YZ)dZ*dZ+dZ,ie)de*de+de,de��e*6Z-de"fd��YZ.de.fd ��YZ/d!e.fd"��YZ0dS(#i����(twith_statementN(tImporterHelpert
import_modulet	shell_outtsos_get_command_output(tIndependentPlugintExperimentalPlugin(t_sos(t
SoSOptionst
_arg_names(tfill(tprint_(tinputs/var/lib/sos/presetscC�s4d|}yt|t�SWntk
r/dSXdS(Nssos.policies.%s(RtPolicytImportErrortNone(tnamet
policy_fqname((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt
import_policys


cC�s�d|kr|jd�Sddl}t|j�}xM|j�D]?}x6t|�D](}|j�rT|d|�|d<qTqTWqAWd|kr�t�|d<n|dS(Ntpolicyi����tsysroot(tgettsos.policiesRtpoliciestget_modulesRtcheckt
GenericPolicy(tcacheRtsosthelpertmoduleR((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytload#s
t
InitSystemcB�sheZdZd
d
d
d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�ZRS(s�Encapsulates an init system to provide service-oriented functions to
    sos.

    This should be used to query the status of services, such as if they are
    enabled or disabled on boot, or if the service is currently running.
    cC�sXi|_||_d|j|fp(d|_d|j|fpDd|_|j�dS(Ns%s %s(tservicestinit_cmdRtlist_cmdt	query_cmdtload_all_services(tselfR"R#R$((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt__init__<s
		cC�s1|jr-||jkr-|j|ddkStS(s'Check if given service name is enabled tconfigtenabled(R!tFalse(R&R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt
is_enabledFscC�s1|jr-||jkr-|j|ddkStS(s*Check if a given service name is disabled R(tdisabled(R!R*(R&R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytis_disabledLscC�s
||jkS(syChecks if the given service name exists on the system at all, this
        does not check for the service status
        (R!(R&R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt
is_serviceRscC�stS(s�Checks if the given service name is in a running state.

        This should be overridden by initsystems that subclass InitSystem
        (tTrue(R&R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt
is_runningXs	cC�sdS(s�This loads all services known to the init system into a dict.
        The dict should be keyed by the service name, and contain a dict of the
        name and service status
        N((R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR%cscC�s@|jr<ytd|j|f�SWq<tk
r8dSXndS(sQuery an individual services%s %sN(R$Rt	ExceptionR(R&R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt_query_servicejs	
cC�s|S(s�Parses the output returned by the query command to make a
        determination of what the state of the service is

        This should be overriden by anything that subclasses InitSystem
        ((R&toutput((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytparse_querysscC�sb|j|�}|dk	rEi|d6|j|d�d6|dd6Si|d6dd6dd6SdS(siReturns the status for the given service name along with the output
        of the query command
        RR3tstatustmissingtN(R2RR4(R&Rtsvc((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_service_status{s

N(
t__name__t
__module__t__doc__RR'R+R-R.R0R%R2R4R9(((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR 4s
								tSystemdInitcB�s,eZd�Zd�Zd�Zd�ZRS(cC�s)tt|�jdddddd�dS(NR"t	systemctlR#slist-unit-files --type=serviceR$R5(tsuperR=R'(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR'�scC�s>x7|j�D])}|j�jd�r
|j�dSq
WdS(NsActive:itunknown(t
splitlineststript
startswithtsplit(R&R3tline((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR4�scC�s�t|j�j�}xd|D]\}yB|jd�d}|j�d}i|d6|d6|j|<Wqtk
rwqXqWdS(Ns.serviceiiRR((RR#RARDR!t
IndexError(R&tsvcsRERR(((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR%�s

cC�s|j|�}|ddkS(NR5tactive(R9(R&RR8((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR0�s(R:R;R'R4R%R0(((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR=�s			
tPackageManagercB�s�eZdZdZdZdZdZdZdddddd�Z	d�Z
dd�Zd�Zd�Z
d�Zd�Zd	�Zd
�ZRS(sAEncapsulates a package manager. If you provide a query_command to the
    constructor it should print each package on the system in the following
    format::

        package name|package.version

    You may also subclass this class and provide a get_pkg_list method to
    build the list of packages and versions.
    cC�s|i|_g|_|r|nd|_|r3|nd|_|rH|nd|_|r]|nd|_|rx||_ndS(N(tpackagestfilesRt
query_commandtverify_commandt
verify_filtert
files_commandtchroot(R&RPRLRMRNRO((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR'�s		cC�stj|j�j�|�S(s<
        Return a list of packages that match name.
        (tfnmatchtfiltertall_pkgstkeys(R&R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytall_pkgs_by_name�sicC�sDtj||�}g|j�j�D]}|j|�r%|^q%S(sB
        Return a list of packages that match regex_name.
        (tretcompileRSRTtmatch(R&t
regex_nametflagstregtpkg((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytall_pkgs_by_name_regex�scC�s:|j|�}t|�dkr2|j|�dSdSdS(s<
        Return a single package that matches name.
        ii����N(RUtlenR(R&Rt
pkgmatches((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytpkg_by_name�scC�s
|jr|j}t|ddd|j�j�}x�|D]�}d|krRq:nc|jd�dkr�|jd�\}}d}n0|jd�dkr�|jd�\}}}ni|d6|jd�d	6|j|<|r�|nd}||j|d
<q:Wn|jS(s�Returns a dictionary of packages in the following
        format::

            {'package_name': {'name': 'package_name',
                              'version': 'major.minor.version'}}

        ttimeoutiRPt|iiRt.tversiontreleaseN(RLRRPRAtcountRDRRJ(R&tcmdtpkg_listR\RRdRe((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_pkg_list�s$		
	cC�s"|js|j�|_n|jS(s0
        Return a list of all packages.
        (RJRi(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyRSs	cC�sE|jd�}|d\}}}dj|d �}||||fS(Nt-i����(RDtjoin(R&R\tfieldsRdRetarchR((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytpkg_nvra
scC�sP|jrI|jrI|j}t|ddd|j�}|j�|_n|jS(sF
        Returns a list of files known by the package manager
        RaiRP(RORKRRPRA(R&RgRK((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt	all_filess
	cC�s�|js
dS|j}tdt||��}|s8dSd}xp|D]h}x_|D]W}tg|jD]}||k^qe�r�qRnt|�r�|d7}n||7}qRWqEW|jd|S(s�build_verify_command(self, packages) -> str
            Generate a command to verify the list of packages given
            in ``packages`` using the native package manager's
            verification tool.

            The command to be executed is returned as a string that
            may be passed to a command execution routine (for e.g.
            ``sos_get_command_output()``.

            :param packages: a string, or a list of strings giving
                             package names to be verified.
            :returns: a string containing an executable command
                      that will perform verification of the given
                      packages.
            :returntype: str or ``NoneType``
        R7t N(RMRR]RRtmaptanyRNR^(R&RJtby_regextverify_listtverify_packagestpackage_listtpackagetf((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytbuild_verify_commands		

(
N(R:R;R<RRLRMRNRPRKR'RUR]R`RiRSRnRoRy(((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyRI�s"			
				
tdesctnotetargstPresetDefaultscB�skeZdZdZdZdZe�Ze	Z
d�Zd�Zddde�d�Z
d�Zd�ZRS(s"Preset command line defaults.
    cC�s&d|j|j|jt|j�fS(seReturn a human readable string representation of this
            ``PresetDefaults`` object.
        s!name=%s desc=%s note=%s opts=(%s)(RRzR{tstrtopts(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt__str__YscC�s&d|j|j|jt|j�fS(sgReturn a machine readable string representation of this
            ``PresetDefaults`` object.
        s6PresetDefaults(name='%s' desc='%s' note='%s' opts=(%s)(RRzR{treprR(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt__repr__`sR7cC�s(||_||_||_||_dS(stInitialise a new ``PresetDefaults`` object with the specified
            arguments.

            :param name: The name of the new preset
            :param desc: A description for the new preset
            :param note: Note for the new preset
            :param opts: Options set for the new preset
            :returns: The newly initialised ``PresetDefaults``
        N(RRzR{R(R&RRzR{R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR'gs
			cC�s�|jrtd��n|jj�}ii|jt6|jt6|t6|j	6}t
jj|�szt
j
|dd�ntt
jj||j	�d��}tj||�WdQXdS(s�Write this preset to disk in JSON notation.

            :param presets_path: the directory where the preset will be
                                 written.
        sCannot write built-in presettmodei�twN(tbuiltint	TypeErrorRtdictRztDESCR{tNOTEtOPTSRtostpathtexiststmakedirstopenRktjsontdump(R&tpresets_pathtodicttpdicttpfile((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytwritevs	+$cC�s#tjtjj||j��dS(N(R�tunlinkR�RkR(R&R�((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytdelete�sN(R:R;R<RRRzR{RRR/R�R�R�R'R�R�(((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR}Js				tnonesDo not load a presets+Use to disable automatically loaded presetsRRR
cB�s�eZed�ZdZdZdZdZdZdZ	dZ
ie�d6Ze
ZeZdZd)d�Zd�Zd�Zd	�Zeeeed
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#ed�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d �Z.d)ed!�Z/d"�Z0ed#�Z1d$�Z2d%�Z3d)d&�Z4d)d)d)e5�d'�Z6dd(�Z7RS(*s�This command will collect system configuration and diagnostic information from this %(distro)s system. An archive containing the collected information will be generated in %(tmpdir)s.

For more information on %(vendor)s visit:

  %(vendor_url)s

The generated archive may contain data considered sensitive and its content should be reviewed by the originating organization before being passed to any third party.

No changes will be made to system configuration.
%(vendor_text)s
tUnknownshttp://www.example.com/R7tlegacyt/cC�sL|j�d|_t�|_g|_|j�||_|jt	�dS(sJSubclasses that choose to override this initializer should call
        super() to ensure that they get the required platform bits attached.
        super(SubClass, self).__init__(). Policies that require runtime
        tests to construct PATH must call self.set_exec_path() after
        modifying PATH in their own initializer.N(
t_parse_unameRtcase_idRItpackage_managert_valid_subclassest
set_exec_patht
_host_sysroottregister_presetstGENERIC_PRESETS(R&R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR'�s
		
	cC�stg|jS(N(RR�(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_valid_subclasses�scC�s
||_dS(N(R�(R&t
subclasses((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytset_valid_subclasses�scC�s
|`dS(N(R�(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytdel_valid_subclasses�ss/list of subclasses that this policy can processcC�stS(s|
        This function is responsible for determining if the underlying system
        is supported by this policy.
        (R*(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR�scC�s|jS(sH Returns True if sos is running inside a container environment.
        (t
_in_container(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytin_container�scC�s|jS(N(R�(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pythost_sysroot�scC�sdS(s'
        Return the OS version
        N((R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytdist_version�scC�sddlm}|S(sb
        Return the class object of the prefered archive format for this
        platform
        i����(tTarFileArchive(tsos.archiveR�(R&R�((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_preferred_archive�scC�s|j�jd�d}|j}|jdj}d}djd�td�D��}|jdkr�d}|r|d|nd}d	}nS|jd
kr�d}|r�d|nd}|r�d|nd}d
}n	|j}|jd|d|d|d|d|�}|j	t
j|��S(s�
        This function should return the filename of the archive without the
        extension.

        This uses the policy's name_pattern attribute to determine the name.
        There are two pre-defined naming patterns - 'legacy' and 'friendly'
        that give names like the following:

        legacy - 'sosreport-tux.123456-20171224185433'
        friendly - 'sosreport-tux-mylabel-123456-2017-12-24-ezcfcop.tar.xz'

        A custom name_pattern can be used by a policy provided that it
        defines name_pattern using a format() style string substitution.

        Usable substitutions are:

            name  - the short hostname of the system
            label - the label given by --label
            case  - the case id given by --case-id or --ticker-number
            rand  - a random string of 7 alpha characters

        Note that if a datestamp is needed, the substring should be set
        in the name_pattern in the format accepted by strftime().

        RcitcmdlineoptsR7cs�s!|]}tjtj�VqdS(N(trandomtchoicetstringtascii_lowercase(t.0tx((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pys	<genexpr>siR�ssosreport-{name}{case}{date}s
-%Y%m%d%H%M%Stfriendlys*sosreport-{name}{label}{case}{date}-{rand}Rjs	-%Y-%m-%dRtlabeltcasetdatetrand(tget_local_nameRDR�tcommonsR�Rktrangetname_patterntformattsanitize_filenamettimetstrftime(R&RR�R�R�R�tnstr((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_archive_name�s,						cC�s|S(N((R&tbinary((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt_get_pkg_name_for_binary(scC�s�|}|dkrd|}n|jd�r�y*|j|�}|jj�|d}Wntk
rv}dg}nX|ddgkr�d||f}q�n|S(	Ntgzips%s -2txzRdu0u5u2s%s -T%d(RCR�R�RSR1(R&tmethodtthreadsRgt
xz_packaget
xz_versionte((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_cmd_for_compress_method+s

cC�s|stj�S|S(N(ttempfilet
gettempdir(R&topt_tmp_dir((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_tmp_dir=s
cC�s|jS(N(tdefault_scl_prefix(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_default_scl_prefixBscC�sHt|�dkr@x+|D] }t||jd�r|SqWn|dS(Nii(R^t
issubclasstvalid_subclasses(R&tplugin_classestp((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytmatch_pluginEs

c�s@tg|j}|r&|tg7}nt�fd�|D��S(sQ
        Verifies that the plugin_class should execute under this policy
        c3�s|]}t�|�VqdS(N(R�(R�tclass_(tplugin_class(s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pys	<genexpr>Vs(RR�RRr(R&R�texperimentalR�((R�s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytvalidate_pluginOs
cC�sdS(s>
        This function is called prior to collection.
        N((R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytpre_workYscC�sdS(sQ
        This function is called after the sosreport has been generated.
        N((R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt	post_work_scC�s|jj|�S(N(R�R`(R&R\((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR`escC�s_tj�\}}}}}}||_||_||_|j�ddk|_||_dS(NitSMP(tplatformtunametsystemthostnameReRDtsmptmachine(R&R�tnodeReRdR�t	processor((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR�hs			cC�s
||_dS(N(R�(R&R�((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytset_commonsqscC�s|tjd<dS(NtPATH(R�tenviron(R&R�((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt	_set_PATHtscC�s|j|j�dS(N(R�R�(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR�wscC�stj�dkS(seThis method should return true if the user calling the script is
        considered to be a superuseri(R�tgetuid(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytis_rootzscC�sdS(sRReturns the string name of the hashlib-supported checksum algorithm
        to usetmd5((R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_preferred_hash_namescC�s�|r|rtS|j�|rB|jtd�|dt�n|jtd|�dt�|j�|r�|jtd�|�|j�|jtd��n|j�dS(Ns4Your sosreport has been generated and saved in:
  %stalwayss'sosreport build tree is located at : %ssThe checksum is: s5Please send this file to your support representative.(R*t_printt_R/(R&tarchivet	directorytchecksum((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytdisplay_results�s


cC�s8|s|jdjr4|r*t|�q4t�ndS(sSA wrapper around print that only prints if we are not running in
        quiet modeR�N(R�tquietR(R&tmsgR�((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR��s
cC�s�d}|ji|jd6|jd6|jd6|jd6|jdd6}d}x1|j�D]#}|t||dt�d	}q\W|S(
sThis method is used to prepare the preamble text to display to
        the user in non-batch mode. If your policy sets self.distro that
        text will be substituted accordingly. You can also override this
        method to do something more complicated.iHtdistrotvendort
vendor_urltvendor_textttmpdirR7treplace_whitespaces
(	R�R�R�R�R�R�RAR
R*(R&twidtht_msgt_fmtRE((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_msg�s

!cC�s&|ri|_n|jj|�dS(sAdd new presets to this policy object.

            Merges the presets dictionary ``presets`` into this ``Policy``
            object, or replaces the current presets if ``replace`` is
            ``True``.

            ``presets`` should be a dictionary mapping ``str`` preset names
            to ``<class PresetDefaults>`` objects specifying the command
            line defaults.

            :param presets: dictionary of presets to add or replace
            :param replace: replace presets rather than merge new presets.
        N(tpresetstupdate(R&Rtreplace((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR��scC�s5x.|jj�D]}||kr|j|SqWdS(s�Find a preset profile matching the specified preset string.

            :param preset: a string containing a preset profile name.
            :returns: a matching PresetProfile.
        N(RRTR(R&tpresetRX((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytfind_preset�scC�s|jtS(s�Return a ``PresetDefaults`` object matching the runing host.

            Stub method to be implemented by derived policy classes.

            :returns: a ``PresetDefaults`` object.
        (Rt	NO_PRESET(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytprobe_preset�sc	C�s`|p|j}tjj|�s%dSx4tj|�D]#}tjj||�}ytjt|��}Wnt	k
rq5nXx�|j
�D]�}t|dt��}||}t
|kr�|t
nd|_t|kr�|tnd|_t|kr>x?tD]4}||tkrt|j||t|�qqWnt|_||j|<q�Wq5WdS(s�Load presets from disk.

            Read JSON formatted preset data from the specified path,
            or the default location at ``/var/lib/sos/presets``.

            :param presets_path: a directory containing JSON presets.
        NRR7(R�R�R�R�tlistdirRkR�RR�t
ValueErrorRTR}RR�RzR�R{R�R	tsetattrRR*R�R(R&R�tpreset_pathtpreset_dataRtpdtdatatarg((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytload_presets�s(


%	c	C�s�|j}|std��n||jj�krFtd|��ntd|d|d|d|�}t|_||j|j<|j|�dS(s�Add a new on-disk preset and write it to the configured
            presets path.

            :param preset: the new PresetDefaults to add
        sPreset name cannot be emptys&A preset with name '%s' already existsRRzR{RN(	R�R
RRTR}R*R�RR�(R&RRzR{RR�R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt
add_preset�s	!	cC�s|s||jj�kr/td|��n|j|}|jr[td|j��n|j|j�|jj|�dS(NsUnknown profile: '%s's"Cannot delete built-in preset '%s'(RRTR
R�RR�R�tpop(R&RR((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt
del_presets
	N(8R:R;R�R�R�R�R�R�R�R�R�R}RtPRESETS_PATHR�R*R�R�RR'R�R�R�tpropertyR�RR�R�R�R�R�R�R�R�R�R�R�R�R�R`R�R�R�R�R�R�R�R�RR�R	RRRRR(((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR
�sf											8					

														
		 RcB�seZdZd�ZRS(s�This Policy will be returned if no other policy can be loaded. This
    should allow for IndependentPlugins to be executed on any systemcC�s|ji|jd6S(NR�(R�R�(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR$s(R:R;R<R(((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR stLinuxPolicycB�s�eZdZdZdZdZdZdZdd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�ZRS(sfThis policy is meant to be an abc class that provides common
    implementations used in Linux distrostLinuxRs/bin:/sbin:/usr/bin:/usr/sbincC�sQtt|�jd|�|j�|jdkrAt�|_nt�|_dS(NRtsystemd(R?RR'tinit_kernel_modulestinitR=tinit_systemR (R&R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR'3s

cC�s�|jr|jSd}ytdd�}Wntk
rF||_|SX|j�}|jd�dkrqd}n|j�||_|S(NR�s/proc/sys/crypto/fips_enabledtrt1itsha256(t_preferred_hash_nameR�tIOErrortreadtfindtclose(R&R�tfptfips_enabled((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR�;s	
		
	cC�sdyEtd��3}d}|j�}ttj||�d�SWdQXWnttfk
r_dSXdS(Ns/etc/inittabsid:(\d{1}):initdefault:ii(R�R%tintRVtfindallRFR$(R&R(tpatternttext((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytdefault_runlevelNs$cC�s|jS(N(Re(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytkernel_versionWscC�s|jS(N(R�(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt	host_nameZscC�s|jS(N(R�(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt
is_kernel_smp]scC�s|jS(N(R�(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pytget_arch`scC�s
|j�S(s)Returns the name usd in the pre_work step(R0(R&((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR�cscC�stjdd|�S(Ns[^-a-z,A-Z.0-9]R7(RVtsub(R&R((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR�gscC�sHtddd�j�}g|D]}|j�dj�^q|_dS(sxObtain a list of loaded kernel modules to reference later for plugin
        enablement and SoSPredicate checks
        tlsmodRaiN(RRARDRBtkernel_mods(R&tlinesRE((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyRjscC�s�|jd}|jr|jnd}|jr�|jr�y'ttd�|�|_|j�Wq�tk
r�|j��q�Xn|jr�|j|_ndS(NR�R7sGPlease enter the case id that you are generating this report for [%s]: (R�R�tbatchR�RR�R�tKeyboardInterrupt(R&tcmdline_optstcaseid((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR�qs






	N(R:R;R<R�R�R�RRR#R'R�R.R/R0R1R2R�R�RR�(((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyR(s"										(1t
__future__RR�RVR�R�R�RQR�R�R�t
sos.utilitiesRRRRtsos.pluginsRRRRR�RR	ttextwrapR
tsixRt	six.movesRRRRRtobjectR R=RIR�R�R�R}R
tNO_PRESET_DESCtNO_PRESET_NOTER�R
RR(((s9/usr/lib/python2.7/site-packages/sos/policies/__init__.pyt<module>sH"	X!�C��