????

Your IP : 216.73.216.152


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

�
Dr^c@s�ddlmZddlZddlZddlZddlmZddlmZm	Z	m
Z
ddlmZ
ddlmZejjdd�y$dd	lmZdd
lmZWnek
r�nXdZdefd
��YZdZdZede�Zede�Zedede�Zddddddddddddddd d!d"d#gZd$Zd%Z d&Z!d'Z"eZ#d(Z$d)Z%ed*d+d,d-g�Z&d.Z'd/Z(d0Z)d1Z*eded*d2g�Z+d3Z,d4Z-ededed5e�Z.d6Z/d7Z0d8Z1ie
d9e d:e!d;e0d<e�e 6e
d9e"d:e#�e"6e
d9e$d:e%d<e&�e$6e
d9e'd:e(d;e1d<e�e'6e
d9e)d:e*d;e0d<e+�e)6e
d9e,d:e-d;e/d<e.�e,6Z2d=Z3d>efd?��YZ4d@e4fdA��YZ5dBZ6dCZ7dDZ8ie
d9e6d:e8d;e0d<e�e66Z9dEe4fdF��YZ:dGe4fdH��YZ;dIe:fdJ��YZ<dKefdL��YZ=dS(Mi����(tprint_functionN(tRedHatPlugin(tLinuxPolicytPackageManagertPresetDefaults(t_sos(t
SoSOptionsis/usr/share/rhn/(tup2dateAuth(trpclibs/etc/os-releasetRedHatPolicycBs�eZdZdZdZdZdZdZdZdZ	ddgZ
eZd	Z
d
ZdZdZdd
�Zed��Zd�Zd�Zd�Zd�Zd�Zd�ZRS(tCentOSshttp://www,centos.org/s/etc/redhat-releases/var/tmps7rpm -qa --queryformat "%{NAME}|%{VERSION}|%{RELEASE}\n"srpm -qalsrpm -Vt	debuginfos-develt/s/opt/rhtfriendlytsystemdcCs�tt|�jd|�d|_t|_|rG|j�||_n|j�}td|j	d|j
d|jd|jd|�|_
tg|_|j
j�|_|j
j�}|js�tdd	tj�tjd
�n|stdd	tj�tjd
�n|j|j�|_|jr5d|_n	d
|_|jtjd7_|jtjd7_|j�|j�dS(Ntsysroottt
query_commandtverify_commandt
verify_filtert
files_commandtchroots'Could not obtain installed package listtfileisNCould not obtain the files list known to the package                   managers/usr/sbin:/usr/bin:/root/bins'/sbin:/bin:/usr/sbin:/usr/bin:/root/bins/usr/local/bins/usr/local/sbin(tsuperR	t__init__t
ticket_numbertFalsetusrmovet_container_initt
_host_sysrootRt	_rpmq_cmdt	_rpmv_cmdt_rpmv_filtert
_rpmql_cmdtpackage_managerRtvalid_subclassestall_pkgstpkgst	all_filestprinttsyststderrtexitt
check_usrmovetPATHtostpathsept
set_exec_pathtload_presets(tselfRtfiles((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR1s<		
						
cCstS(s�This method checks to see if we are running on CentOS. It must be
        overriden by concrete subclasses to return True when running on a
        Fedora, RHEL or CentOS distribution or False otherwise.(R(tcls((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pytcheck]scCsXd|kr.tjjd�o-tjjd�S|dd}|ddkrPtStSdS(sqTest whether the running system implements UsrMove.

            If the 'filesystem' package is present, it will check that the
            version is greater than 3. If the package is not present the
            '/bin' and '/sbin' paths are checked and UsrMove is assumed
            if both are symbolic links.

            :param pkgs: a packages dictionary
        t
filesystems/bins/sbintversionit3N(R-tpathtislinktTrueR(R1R%tfilesys_version((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR+ds
"cCsHg}d�}|jr@x!|D]}|j||��qW|S|SdS(s2Mangle paths for post-UsrMove systems.

            If the system implements UsrMove, all files will be in
            '/usr/[s]bin'. This method substitutes all the /[s]bin
            references in the 'files' list with '/usr/[s]bin'.

            :param files: the list of package managed files
        cSsKddg}||kr5|tjjd|d�fStjdd|�fS(Ns/bin/rpms
/bin/mailxs/usris(^)(/s?bin)s\1/usr\2(R-R8tjointretsub(R8t
skip_paths((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyttransform_pathsN(Rtextend(R1R2tpathsR@tf((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pytmangle_package_pathts			
cCs�ttjkr1tjtdkr1t|_q1nttjkrStjt|_n|joh|jdk}|r�tjj|j|j	�}||_	n|r�|jSdS(s�Check if sos is running in a container and perform container
        specific initialisation based on ENV_HOST_SYSROOT.
        tdockertociR(RERFN(t
ENV_CONTAINERR-tenvironR:t
_in_containertENV_HOST_SYSROOTRR8tabspatht_tmp_dirtNone(R1tuse_sysrootthost_tmp_dir((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR�scCs�ddlm}m}g}|d|dtd|d|dddt�}|j�\}}|rf|Sxj|j�d	D]X}y|jd
d	�\}	}
Wntk
r�qwX|
dkrw|jt|	��qwqwW|S(Ni����(tPopentPIPEs"LC_ALL=C /sbin/chkconfig --list %stshelltstdoutR)tbufsizet	close_fdsit:ton(	t
subprocessRPRQR:tcommunicatetsplitt
IndexErrortappendtint(R1tnameRPRQtrettptoutterrttabstrunleveltonoff((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pytrunlevel_by_service�s&
	
cCs|s
|jS|S(N(RL(R1topt_tmp_dir((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pytget_tmp_dir�scCs
|j�S(N(t	host_name(R1((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pytget_local_name�sN(t__name__t
__module__tdistrotvendort
vendor_urlt_redhat_releaseRLRR!RR RRIRtdefault_scl_prefixtname_patterntinitRMRtclassmethodR4R+RDRRfRhRj(((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR	!s,,					t	containertHOSTtverifytall_logstabrttblocktboottdnftdracuttfilesystgrub2thardwarethosttkerneltlogstlvm2tmemorytrpmtprocessRtyumtxfssCentOS LinuxtrhvsRed Hat VirtualizationtrheltrhosptRDOtplugoptssprocess.lsof=offs#networking.ethtool_namespaces=Falsesnetworking.namespaces=200tocpt	OpenShiftt	satellitet	Satellites
apache.log=ontcantboots(For use when normal system startup failstonlypluginss9Data collection will be limited to a boot-affecting scopes(This preset may increase report run times1This preset may increase report size and run timeR^tdesctnotetoptssZ
Any information provided to %(vendor)s will be treated in accordance with the published support policies at:

  %(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.
t
RHELPolicycBsmeZdZdZdZeded�Zdd�Z	e
d��Zd�Zd�Z
d	�Zd
�ZRS(sCentOS LinuxR
shttps://wiki.centos.org/sThis command will collect diagnostic and configuration information from this %(distro)s system and installed applications.

An archive containing the collected information will be generated in %(tmpdir)s and may be provided to a %(vendor)s support representative.
s%(vendor_text)s
cCs*tt|�jd|�|jt�dS(NR(RR�Rtregister_presetstrhel_presets(R1R((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR
scCs�tjjt�stSttd��d}xZ|D]R}|jd�r/|jd�\}}|jd�}|j|j	�r�t
Sq/q/WWdQXtS(s�Test to see if the running host is a RHEL installation.

            Checks for the presence of the "CentOS Linux"
            release string at the beginning of the NAME field in the
            `/etc/os-release` file and returns ``True`` if it is
            found, and ``False`` otherwise.

            :returns: ``True`` if the host is running RHEL or ``False``
                      otherwise.
        trtNAMEt=s"'N(R-R8texistst
OS_RELEASERtopent
startswithRZtstripRmR:(R3RCtlineR^tvalue((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR4s
cCs�y�|jjd�}|j|dd}|ddkr>dS|ddkrRdS|dd	krfd
S|ddkrzdS|dd
kr�dSWntk
r�nXtS(Nsredhat-release*iR6t4it5Servert5Clientit6it7it8i(R�R�(R"tall_pkgs_by_name_regexR%t	ExceptionR(R1trrtpkgname((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pytdist_version)s 
cCsQy8tjjtj��ddd}|jdd�SWntk
rLdSXdS(Nitusernamesutf-8tignoreR(Rt	xmlrpclibtloadsRtgetSystemIdtencodeR�(R1trhn_username((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR�;s	
cCs|j�p|j�S(N(R�Ri(R1((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyRjDscCsQ|jd�dk	r"|jt�S|jd�dk	rD|jt�S|jt�S(Nssatellite-commons
rhosp-release(tpkg_by_nameRMtfind_presettRH_SATELLITEtRHOSPtRHEL(R1((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pytprobe_presetGs


N(RkRlRmRnRot_tdisclaimer_texttmsgRMRRtR4R�R�RjR�(((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR��s				tCentOsPolicycBseZdZdZdZRS(R
shttp://www.centos.org/(RkRlRmRnRo(((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR�RstatomictAtomicsCentOS Linux Atomic HosttRedHatAtomicPolicycBsFeZdZeded�Zdd�Zed��Z	d�Z
RS(sCentOS Atomic Hosts�This command will collect diagnostic and configuration information from this %(distro)s system.

An archive containing the collected information will be generated in %(tmpdir)s and may be provided to a %(vendor)s support representative.
s%(vendor_text)s
cCs*tt|�jd|�|jt�dS(NR(RR�RR�tatomic_presets(R1R((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyRmscCs�t}ttjkr|Stjt|j}tjj|�sCtSy:x3t|d�j�j	�D]}|t
|kO}qbWWntk
r�nX|S(NR�(RRJR-RHRpR8R�R�treadt
splitlinestATOMIC_RELEASE_STRtIOError(R3R�thost_releaseR�((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR4qs"
cCs)|jd�r|jt�S|jt�S(Nsatomic-openshift(R�R�tRHOCPtATOMIC(R1((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR��s
N(RkRlRmR�R�R�RMRRtR4R�(((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR�bstRedHatCoreOSPolicycBsFeZdZeded�Zdd�Zed��Z	d�Z
RS(sRed Hat CoreOSs�This command will collect diagnostic and configuration information from this %(distro)s system.

An archive containing the collected information will be generated in %(tmpdir)s and may be provided to a %(vendor)s support representative.
s%(vendor_text)s
cCstt|�jd|�dS(NR(RR�R(R1R((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR�scCst}ttjkr|Stjt|j}y:x3t|d�j�j�D]}|d|kO}qLWWntk
rznX|S(NR�sRed Hat CoreOS(	RRJR-RHRpR�R�R�R�(R3tcoreosR�R�((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR4�s"
cCs
|jt�S(N(R�R�(R1((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR��sN(RkRlRmR�R�R�RMRRtR4R�(((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR��s
tCentOsAtomicPolicycBseZdZdZdZRS(sCentOS Atomic HostR
shttp://www.centos.org/(RkRlRmRnRo(((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR��stFedoraPolicycBs>eZdZdZdZdd�Zed��Zd�Z	RS(tFedorasthe Fedora Projectshttps://fedoraproject.org/cCstt|�jd|�dS(NR(RR�R(R1R((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR�scCstjjd�S(sXThis method checks to see if we are running on Fedora. It returns
        True or False.s/etc/fedora-release(R-R8tisfile(R3((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR4�scCs0|jd�p|jd�d}t|d�S(Nsfedora-releasesfedora-release-.*i����R6(R�R�R](R1tpkg((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pytfedora_version�sN(
RkRlRmRnRoRMRRtR4R�(((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyR��s(>t
__future__RR-R(R=tsos.pluginsRtsos.policiesRRRtsosRR�RR8tinserttup2date_clientRtrhnRtImportErrorR�R	RGRJR:t_opts_verifyt_opts_all_logst_opts_all_logs_verifyt	_cb_plugstRHEL_RELEASE_STRtRHVtRHV_DESCR�t	RHEL_DESCR�t
RHOSP_DESCt
RHOSP_OPTSR�t
RHOCP_DESCR�tRH_SATELLITE_DESCtSAT_OPTStCBtCB_DESCtCB_OPTStCB_NOTEt	NOTE_TIMEtNOTE_SIZE_TIMER�R�R�R�R�R�tATOMIC_DESCR�R�R�R�R�(((s7/usr/lib/python2.7/site-packages/sos/policies/redhat.pyt<module>s�
�

%S
%!