https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /usr/lib/python2.7/site-packages/redhat_support_lib/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pyo
�
f�Tc@s~ddlmZddlZddlZddljZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZejd�ZdZdZdZd�Zd�Zd	�Zdedd
�Zd�Zd�Zdd
�Zddedd�Zedkrzeej�dkrgedejd�ZdeGHqzdejdGHndS(i����(treportNs%redhat_support_lib.utils.reporthelpersTim Walsh tdwalsh@redhat.coms#Keith Robertson kroberts@redhat.comi�cCs�d}y�ddl}|j�}tjj|�}|}xu|s�|jd|�}x.|D]&}d|d|d|df}Pq[Wtjj|�}t|�dkr<Pq<q<W|jd|�s�dSWnt	k
r�nX|S(	s�
    Find the rpm name that provides a specific file.

    fileName -- Find the rpm package that supplies this file.

    Equivalent to

    rpm -qf /etc/passwd

    setup-2.8.48-1.fc17
    i����Nt	basenamess%s-%s-%stnametversiontreleasei(
tNonetrpmtTransactionSettostpathtabspathtdbMatchtdirnametlentImportError(tfileNametrpmNameRttstorigFileNametheadersth((sI/usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pytrpm_for_file,s&	

cCs�yutjddd|gdtjdtj�}|j�\}}|jdkrat|�j�Stj|�t	�Wn+t	k
r�}tjd||f�dSXdS(	Ntfiles-bis--tstdouttstderris0Problem determing file type of %s. Exception: %ss(application/octet-stream; charset=binary(
t
subprocesstPopentPIPEtcommunicatet
returncodetstrtrstriptloggertdebugt	Exception(RtprocRRte((sI/usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pyt
get_file_typeOs	

	cCs�tjd�}t|d�}tjj|�}zkxd|dkr�|jd�}|dkrptd|��n|t	|�}tj
||�r6tSq6WWd|j�Xt
S(Nu[--�-�￾￿]trbiisProblem encountered reading %s(tretcompiletopenRR	tgetsizetreadRR"R
tsearchtTruetclosetFalse(Rtillegal_xml_charstftcounttcontent((sI/usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pytcontains_invalid_xml_chars`sc	Csc|stjj|�}nt|�}tjj|�|ksft|�jd�dksft|�r�|j|�|j	t
jd|d|d|ddtjj|���n�t|d�}z|j
�}Wd	|jXtjd
|�r|jdd�}d
|jd�}ny/|j	t
jd|d|d|d|��Wntk
r^}|GHnXd	S(sd
    Process a specific fileName as either a value in xml fileName
    or entry in tar fileName
    scharset=binaryiRRttype_threfs
content/%sR&Ns[&;<>]s]]>s]]]]><![CDATA[>u<![CDATA[%s]]>sutf-8tvalueOf_(RR	tbasenameR%R*RtrfindR4tappendtadd_bindingRtbindingR)R+R.R'R,treplacetdecodeR"(	Rt
report_objttar_refst
max_file_sizeRtmtypeR1R3R$((sI/usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pyt
_process_fileus4	
cCsxitd6td6td6td6td6}|j�}x3|D]+}|j�|kr<t||j�<q<q<W|dr�|jtjdddtj���n|dr�|jtjdddt	|���n|dr|jtjdddtj
���n|dr3|jtjdddtj���n|drt|jtjdddtd�j
tj����nd	S(
s#
    Add the system specific info to the report object.  Handles the  case where
    these objects are already included via ABRT, in which case the ABRT information
    will not be overwritten.
     report_obj -- The redhat_support_lib.xml.report to which binding should be added.
     fileName   -- The original file or directory supplied by the user.  This will be
                   queried to determine package information.

    Information added:
     - Kernel version
     - Package info
     - Hostname
     - OS Arch
     - OS Release
    tkerneltpackagethostnametarchitecturet
os_releaseRR7t N(R-tget_bindingtget_nameR/R;RR<tplatformRRtnodet	processorRtjointdist(R?RtinfotbArytb((sI/usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pyt
_add_sys_info�s0







cCs8x1|D])}|jtjd|d||��qWdS(s
    Add any custom bindings to the content.xml

    report_obj -- The redhat_support_lib.xml.report to which binding should be added.
    custom     -- A dictionary of bindings.  Key will be name and value will
    binding's value.

    e.g.
    <binding name='uid'>500</binding>
    RR7N(R;RR<(R?tcustomti((sI/usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pyt_add_custom�s
c	Cs`d}d}d}z y�tj�}|jdtj�|j|ddddd�t|�dkrltjj|dt	j	j
dtj��j
d	��}tj|d
�}tjdd�}|jd�t|j�|_tj|�j|_|jd
|d|�x�|D]S}tjd|dtjj|�|f�|j|ddtjj|��qWnYtjj|dt	j	j
dtj��j
d	��}t|d�}|j|j��Wnhtk
r0}tj|�y"tjd|�tj |�Wntk
r}nXtd|��nXWd|rH|j!�n|r[|j!�nX|S(s�
     report_obj -- The redhat_support_lib.xml.report to which binding should be added.
     temp_dir   -- A valid directory into which a report file will be placed.
     tar_refs   -- An array of files to be added to the tar.bz2
    s<?xml version="1.0" ?>it
namespace_tt
namespacedef_s(xmlns="http://www.redhat.com/gss/strata"sreport-%s.tar.bz2ttzs%Y%m%d%H%M%Ssw:bz2Rscontent.xmlttarinfotfileobjsadding %s as %s to %ss
content/%starcnames
report-%s.xmltwbs1Cleaning up temp directory %s from failed create.s#Unable to create report file in %s.N("RtStringIOtwriteRtlineseptexportR
R	ROtdatetimetnowR[ttzutctstrftimettarfileR)tTarInfotseektbuftsizetstattst_mtimetmtimetaddfileR R!R8taddtgetvalueR"t	exceptiontshutiltrmtreeR.(	R?ttemp_dirR@touttcontent_xmltout_fileRQRVR$((sI/usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pyt_write_report_file�s`	

*

c
CsDg}d
}tj�}y�tjd|�}tjj|�rgtd|d|d|dtdd�nztjj	|�r�tj
|�}xV|D]?\}}	}
x-|
D]%}ttjj||�||�q�Wq�Wntd��Wn,t
k
r}tj|�t
d	��nXt||�|r4t||�nt|||�S(su
    Make a report.

    A Report is made from a path.  The name and content params allow for customer name/value entry
    into xml.  Typical use is to only use the path name.

    path          -- the file or folder from which a report should be made
    custom        -- A dictionary of bindings.  Key will be name and value will
                     binding's value.
    max_file_size -- The max size (in bytes) of a file  which should be included in content.xml.
    report_dir    -- By default, the generated report file will be placed in a temporary directory
                     created by mkdtemp.  This usually resolves to /tmp; however, if there isn't
                     enough space there you can specify an alternate base dir for temp files.

    Usage:
        Generate report xml with simple name/value binding:
        make_report("kernel", "2.6.32-71.el6.x86_64")

        Generate report xml with a path to process ( /var/spool/abrt/ccpp-2012-07-10-21:30:32-1920 )
        make_report(path="/var/spool/abrt/ccpp-2012-07-10-21:30:32-1920")

    return The path to an XML file or a TGZ depending on the size of 'path'
    tdirRR?R@RARtdescriptions3Please supply a valid file or directory to process.sUnable to generate report file.N(RRttempfiletmkdtempRR	tisfileRCtMAX_FILE_SIZE_BYTEStisdirtwalkROt
ValueErrorR"R R!RTRWRz(
R	RURAt
report_dirR@Rvtrpttpt	root_nametdir_namet
file_namestfnR$((sI/usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pytmake_reports8



t__main__iR	is
File is %ssUsage: %s /path/to/file-or-diri( tredhat_support_lib.xmlRR`Rdtdateutil.tzR[tloggingRRLR'RtRtsysRhR}t	getLoggerR t
__author__R�RR%R4RRCRTRWRzR�t__name__R
targvt	file_name(((sI/usr/lib/python2.7/site-packages/redhat_support_lib/utils/reporthelper.pyt<module>sD	#		&	-	@=

https://t.me/AnonymousX5 - 2025