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 :  /proc/self/root/lib/python2.7/site-packages/redhat_support_tool/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyc
�
��Tc@s�ddlmZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
mZmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lZdd
lZdd
lZdd
ljj Z dd
l!jj"Z"dd
l
jj#Z#dd
ljj$Z$dd
l%Z%dd
l&Z&dd
l'Z'dZ(ej)d�Z*de
fd��YZ+d
S(i����(tdeque(tOption(t_(t	Constants(tLaunchHelper(tVMCore(tInteractivePlugint
DisplayOptiontObjectDisplayOption(t
AddAttachment(t
AddComment(tGetKernelDebugPackages(tDiagnose(tOpenCaseNs%Keith Robertson <kroberts@redhat.com>s%redhat_support_tool.plugins.btextractt	BTExtractcBs�eZdZdZdZdZdZdZe	Z
ed��Zed��Z
ed��Zed��Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zdd
�Zd�Zdd�Zdd�Zd�ZRS(t	btextracttcCs
td�S(s�
        The usage statement that will be printed by OptionParser.

        Example:
            - %prog -c CASENUMBER [options] <comment text here>
        Important: %prog is a OptionParser built-in.  Use it!
        s!%prog [options] </path/to/vmcore>(R(tcls((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyt	get_usage9s	cCstd�|jS(s�
        The description statement that will be printed by OptionParser.

        Example:
            - 'Use the '%s' command to add a comment to a case.'             % cls.plugin_name
        s�Use the '%s' command get a kernel stack backtrace and other related information from a kernel core dump file. The default behavior is to issue 'bt -a'; however, there are a variety of other 'crash' commands that can be run.(Rtplugin_name(R((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pytget_descDs		cCstd�|jS(s
        The epilog string that will be printed by OptionParser.  Usually
        used to print an example of how to use the program.

        Example:
         Examples:
          - %s -c 12345678 Lorem ipsum dolor sit amet, consectetur adipisicing
          - %s -c 12345678
        s"Examples:
  - %s /var/crash/vmcore(RR(R((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyt
get_epilogSscCsHtdddddtd�dd&�tdd	dd
dddtd
�dt�tdddddddtd�dt�tdddddddtd�dt�tdddddddtd�dt�tdddddddtd�dt�tdddd dddtd!�dt�td"d#dd$dtd%�dd&�gS('sO
        Subclasses that need command line options should override this method
        and return an array of optparse.Option(s) to be used by the
        OptionParser.

        Example:
         return [Option("-f", "--file", action="store",
                        dest="filename", help='Some file'),
                 Option("-c", "--case",
                        action="store", dest="casenumber",
                        help='A case')]

         Would produce the following:
         Command (? for help): help mycommand

         Usage: mycommand [options]

         Use the 'mycommand' command to find a knowledge base solution by ID
         Options:
           -h, --help  show this help message and exit
           -f, --file  Some file
           -c, --case  A case
         Example:
          - mycommand -c 12345 -f abc.txt

        s-cs--casetdestt
casenumberthelps9Add the collected data as a comment to the provided case.tdefaults-as--alltalltactiont
store_trues Run all options. Equals -aeflpFis-es	--exframetexframesPSearch the stack for possible kernel and user mode exception frames (ie. bt -e).s-fs--foreachbtt	foreachbts8Display the stack traces for all tasks (ie. foreach bt).s-ls--logtlogs9Dumps the kernel log_buf contents in chronological order.s-ps--pstpss=Displays process status for selected processes in the system.s-Fs--filestfiless&Displays information about open files.s-is	--cmdfiletcmdfiles:Run a sequence of individual 'crash' commands from a file.N(RRtNonetFalse(R((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pytget_optionsbs<cCs
td�S(NsO
Select the crash command output to view or 'e' to return to the previous menu.(R(tself((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pytget_intro_text�scCs|jS(N(t
_submenu_opts(R&((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pytget_sub_menu_options�scCst|�|_dS(s�
        Will create a VMCore object from a given core file
        or throw an exception if crash has a problem inspecting the
        core file for OSRELEASE.
        N(Rtvmcore(R&tfilename((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyt
_check_vmcore�scCsEtj�jdd�}tj||jj��}|rL|jj|�n�td�|j	dGHt
td�|jj��}t|�j�j
�dkr(td�|jj�GHtt�}|j|jj�dt�tj||jj��}|r|jj|�qAttd	���ntd
|jj���dS(sS
        At this point self.vmcore had better be non-null.  This
        method will call vmcorehelper's get_debug_symbols which scans
        the designated debug symbols directory looking for debug symbols
        which match the given core file.  If symbols are found, the
        VMCore object will be passed a VMLinux object.
        toptiontkern_debug_dirs-WARNING: Debug symbols for %s were not found.isWWould you like to install kernel-debuginfo-%s from available debug repositories (y/n)? tysInstalling kernel-debuginfo-%stpt_exceptionsFInstallation of debug images failed, cannot proceed with debug sessionsBUser elected not to install debug packages for kernel-debuginfo-%sN(tconfighelpertget_config_helpertgettvmcorehelpertget_debug_symbolsR*tgetKernelVersiontsetDebugSymbolsRt_argst	raw_inputtstrtstriptlowerRRtruntTruet	Exception(R&t
kernelext_dirtvmlinuxtlinetlh((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyt_find_debug_symbols�s.		
	cCs�|js0td�|j}|GHt|��n|j|jd�y|j�Wnetk
r�}tjtj	|�t
jjd�r�d|_
q�t
jjd�r�d|_
q��nXdS(Ns<ERROR: %s requires the full path to a kernel core dump file.is/usr/sbin/makedumpfiles/sbin/makedumpfile(R8RRR?R,RDtloggerRtloggingtDEBUGtostpathtexiststmkdumpfilepath(R&tmsgte((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyt
validate_args�s		
c	Csat�|_i|_|jr+|j�nRy|j�WnAtk
r|}td�|}|GHtj	t
j|�|�nXy�|jdrx�|jD]z}t
d�|j|�}d}t|�dkr�y�tjdddd�\}}tj|d	�}|j|�|j�tt�}|jd
|jd|jjdd�|f�tj|�d
tjj|�|jjf}Wq�td�GHq�Xn9dt |j!t"j#�t$j%t |j!t"j#�|f}|r�tt&�}|jd|jd|f�t'|_(q�q�WnWnAtk
r\}td�|}|GHtj	t
j|�|�nXdS(Ns	ERROR: %sRcSs
|tjkS(N(tstringt	printable(tx((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyt<lambda>si Ntprefixsvmcoreinfo-tsuffixs-rhsttws-c %s --description="%s" %ssUTF-8treplacesIThe attachment %s was uploaded by Red Hat Support Tool from the VMCore %ss^Unable to upload output to Red Hat Customer Portal, reverting to displaying output to console.sM%s
The following comment was added by Red Hat Support Tool
Version: %s
%s

%ss
-c %s "%s"()RR(t	_sectionsRKt_mkdumpfile_log_fallbackt_execute_bt_commandsR?RRERRFtERRORt_optionstfilterR#tlenttempfiletmkstempRHtfdopentwritetcloseRR	R=tdisplay_texttencodetremoveRItbasenameR*tcoreFilenameR:trulerRtMAX_RULEt	apihelpert
USER_AGENTR
R>t
no_submenu(	R&RMRLtopttfiltered_stringtfdttemppatht
attachmentRC((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pytpostinit�sh		


		

	
		

cCs�|jr
dSd}x"|jD]}||j|7}qWy|jdd�GHWnItk
r�}tjtj|�ddl	}|j|j
�d�GHnXdS(NusUTF-8RVi����(RlR(RWRdR?RERRFtWARNINGtsystgetdefaultencoding(R&tdocRmRMRt((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pytnon_interactive_action5s	cCs0|j|}tj|jdd�dd�dS(NsUTF-8RVtcmdsless -R(RWtpydoct	pipepagerRd(R&tdisplay_optionRv((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pytinteractive_actionKs
cCsy
tjd�}|jd|jjtjj|d�g}tj	|dtj
dtj�}|dkr�td�}t
|��nttjj|d��j�}ttd�d	�}|jj|�||j|<ttd
�d|�}|jj|�||j|<Wn
�nXdS(Ns-rhsts--dump-dmesgtdmesglogtstderrtstdoutis4Unable to get core dmesg log using alternate method.sKernel log buffer (dmesg) logsR|s#Open a support case with dmesg logst	_opencase(R^tmkdtempRKR*RgRHRItjoint
subprocesstcalltSTDOUTtPIPERR?topentreadRR(tappendRWR(R&ttempdirt	mkdumpcmdtretRLtoutputtdisp_opt((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyRXOs0		!	
		cCs tt�}|jd|�dS(NR(RRR=(R&R{RC((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyt_send_to_shadowmanlsc	Csztt�}y,td�|j�}t|�jdd�}t|�jdd�}d}t|�dkr�yitj	dddd	�\}}t
j|d
�}|j|�|j
�|jd|�t
j|�Wq7td�GHq7XnJd
t|jtj�tjt|jtj�|f}|jd|�Wn;tk
ru}td�|}|GHtjtj|�nXdS(NcSs
|tjkS(N(RORP(RQ((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyRRust"t t'i NRSsvmcoreinfo-RTs-rhstRUs--attachment=%ss^Unable to upload output to Red Hat Customer Portal, reverting to displaying output to console.sM%s
The following comment was added by Red Hat Support Tool
Version: %s
%s

%ss-d '%s's	ERROR: %s(RR
R\t
stored_objR:RVR#R]R^R_RHR`RaRbR=ReRRhRRiRjRkR?RERRFRZ(	R&R{RCRnRLRoRpRqRM((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyR�ps:		


cCs�|jdrQt|jd<t|jd<t|jd<t|jd<t|jd<n|jjd�}ttd�d	�}|jj|�||j|<t	j
�rttd
�d|�}|jj|�||j|<ttd�d
|�}|jj|�||j|<n|jdrb|jjd�}ttd�d	�}|jj|�||j|<n|jdr�|jjd�}ttd�d	�}|jj|�||j|<n|jdr
|jjd�}ttd�d	�}|jj|�||j|<n|jdr^|jjd�}ttd�d	�}|jj|�||j|<n|jdr�|jjd�}ttd�d	�}|jj|�||j|<n|jdr�yot|jdd�j
�}|jj|�}ttd�|jdd	�}|jj|�||j|<Wq�tk
r}td�|jd|f}tjtj|�t|��q�XndS(s`
        A utility method which executes the BT commands specified by the
        user.
        RRRRR R!sbt -asOutput from crash 'bt -a'R|sDiagnose 'bt -a' outputR�s'Open a support case with 'bt -a' outputR�sbt -esOutput from crash 'bt -e's
foreach btsOutput from crash 'foreach bt'sOutput from crash 'log'sOutput from crash 'ps'sOutput from crash 'files'R"trsOutput from crash -i %ss Problem opening %s. Error is: %sN(R[R>R*texe_crash_commandsRRR(R�RWtcommontis_interactiveRR�R�R?RERRFRZ(R&R�R�t
file_contentsRMRL((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyRY�s�




	
	
		
	
	
	
	
	
		N(t__name__t
__module__RR#R(RWtend_of_entriesR*RKR$RltclassmethodRRRR%R'R)R,RDRNRrRwR|RXR�R�RY(((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyR/s.A				&		K		-(,tcollectionsRtoptparseRt(redhat_support_tool.helpers.confighelperRt%redhat_support_tool.helpers.constantsRt(redhat_support_tool.helpers.launchhelperRt(redhat_support_tool.helpers.vmcorehelperRtredhat_support_tool.pluginsRRRt*redhat_support_tool.plugins.add_attachmentR	t'redhat_support_tool.plugins.add_commentR
t+redhat_support_tool.plugins.get_kerneldebugRt$redhat_support_tool.plugins.diagnoseRt%redhat_support_tool.plugins.open_caseR
RFtos.pathRHRyt"redhat_support_tool.helpers.commonthelpersR�t%redhat_support_tool.helpers.apihelperRjR4R1ROR�R^t
__author__t	getLoggerRER(((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/btextract.pyt<module>s0

https://t.me/AnonymousX5 - 2025