• File: analyze.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pyc
  • Date Modified: 03/28/2024 3:28 PM
  • File size: 7.94 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

fc@sddlmZddlmZddlmZddlmZmZddl	m
Z
ddlZddlZddl
jjZddljjZddljZddlmZddlmZd	Zejd
ZdefdYZdS(
i(tdeque(t_(tLaunchHelper(tInteractivePlugintObjectDisplayOption(tSymptomN(t
get_file_type(tpathsDan Varga <dvarga@redhat.com>s#redhat_support_tool.plugins.analyzetAnalyzecBseZdZedZedZedZdZdZ	dZ
dZdZe
dZe
dZe
dZdZd	Zd
ZdZdZd
ZdZddZdZRS(tanalyzesAnalyze a file for symptomss2%s of %s symptoms displayed. Type 'm' to see more.sNo more symptoms to displaycCstj|dS(N(Rt__init__(tself((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pyR
.scCs
tdS(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 <file for analysis>(R(tcls((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pyt	get_usage1s	cCstd|j|jfS(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
        sQUse the '%s' command to analyze Python or Java errors contained in output from either Python or Java applications.
Only the first occurrence of the error in the output will be analyzed.
All other types of files/output are unsupported with the '%s' command.

The 'btextract' command is specifically targeted for kernelcore file analysis.
(Rtplugin_name(R((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pytget_desc<s	cCs td|j|j|jfS(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
        sExamples:
- %s /var/log/jbossas/rhevm-slimmed/boot.log
- %s /var/spool/abrt/ccpp-2012-09-28-09:53:26-4080
- %s /var/log/messages
(RR(R((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pyt
get_epilogMs	cCs
tdS(NsO
Type the number of the symptom to view, or 'e' to return to the previous menu.(R(R((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pytget_intro_text_scCs
tdS(NsSelect a Symptom: (R(R((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pytget_prompt_textcscCs|jS(N(t
_submenu_opts(R((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pytget_sub_menu_optionsfscCstd|j}|jstjrg}y,tdGHxtrX|jtq?WWqtk
rt	dj
|jdj|_qXq|GHt
|ndS(NsERROR: %s requires a file.sSPlease provide the file, or text to be analyzed: Ctrl-d on an empty line to submit:s
sutf-8(RRt_linetcommontis_interactivetTruetappendt	raw_inputtEOFErrortstrtjointdecodetstript	Exception(Rtmsgt	userinput((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pyt_check_inputis	
		
cCs|jdS(N(R#(R((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pyt
validate_args~scCs5t|_i|_gtj_|j|jdS(sT
        This is where the work goes down, call do_analysis to do that work
        N(RRt	_sectionstSymptomstAnalyzerPlugintsymptomstdo_analysisR(R((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pytpostinits	cCsx|jD]}d|j|jd|jf}y|jddGHWq
tk
r}tjtj	|ddl
}|j|jdGHq
Xq
WdS(sO
        Running in non-interactive mode, just dump the text to screen
        sAt Line: %d 
 Symptom: %ss
sUTF-8treplaceiN(tresultstline_numtbefore_linettoken_stringtencodeR tloggertlogtloggingtWARNINGtsystgetdefaultencoding(RtrestlineteR5((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pytnon_interactive_actions	cCs|j|jkrtd}x7|jD],}|j|jkr"||j|7}q"q"Wtj|jddddntt}|j	d|dS(s
        This gets invoked when running in interactive mode
        Basically just a hook to get your sub command (symptom) invoked
        usUTF-8R+tcmdsless -RN(tdisplay_texttALLRR%tpydoct	pipepagerR0RRtruntNone(Rtdisplay_optiontdoctopttlh((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pytinteractive_actions
cCsid}tjtj|r{t|}|jds{d|kr]td||fGHntd||fGHq{ntjj	||_
d}xt|j
D]i}tdt|j
d|jd|jdi|d	6}|jj||j|j|j|<qW|setd
}||r4t|n	td7}|GHtjtj|tndS(
sV
        Call the analyzer helper to do the actual work and build the Display
        ttextscharset=s/ERROR: unable to analyze file '%s'.  Reason: %ss;ERROR: unable to analyze non-text file '%s'.  File type: %st[s]  s
		RFtsymptoms8Unable to find any Java or Python application errors in sthe provided input.N(RARtisfilet
expanduserRt
startswithRtanalyzertAnalyzerR	R,RRR-R.tsource_lineRRR/R%R1R2R3R4R (Rtfilenamet	file_typetdisp_optR7R!((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pyR)s4	
"N(t__name__t
__module__RRR=tpartial_entriestend_of_entriesRARR%RPR,R
tclassmethodR
RRRRRR#R$R*R:RFR)(((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pyR$s*									(tcollectionsRt(redhat_support_tool.helpers.confighelperRt(redhat_support_tool.helpers.launchhelperRtredhat_support_tool.pluginsRRt#redhat_support_tool.plugins.symptomRR3R>t$redhat_support_tool.helpers.analyzerthelpersRMt"redhat_support_tool.helpers.commonRtredhat_support_tool.symptomsR(R&t%redhat_support_lib.utils.reporthelperRtosRt
__author__t	getLoggerR1R(((sG/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/analyze.pyt<module>s