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

fc@sddlmZddlmZmZddlmZmZddlm	Z	m
Z
ddlmZddl
mZddlZddlZddljjZddlZdZejd	Zd
e	fdYZdS(i(tdeque(tRequestErrortConnectionError(tEmptyValueErrort_(tInteractivePlugint
DisplayOption(t	Constants(tcommonNs%Keith Robertson <kroberts@redhat.com>sredhat_support_tool.plugins.kbtKbcBseZdZedZdZdZdZe	dZ
e	dZe	dZdZ
dZdZdZd	Zd
ZdZddZd
ZdZRS(tkbsDisplay all sectionscCs
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 <knowledge base solution ID>(R(tcls((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pyt	get_usage*s	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 to find a knowledge base solution by ID(Rtplugin_name(R((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pytget_desc5s		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
        sExample:
  - %s 63568(RR
(R((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pyt
get_epilogAs	cCs
tdS(NsN
Type the number of the section to view or 'e' to return to the previous menu.(R(tself((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pytget_intro_textOscCs
tdS(Ns	Section: (R(R((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pytget_prompt_textSscCs|jS(N(t
_submenu_opts(R((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pytget_sub_menu_optionsVscCstd|j|jf}d|_|jrA|jd|_nztjrttd}|dkrwtnt	|j
}t	|j
r||_qn|GHt|dS(NsTERROR: %s requires a knowledge base solution ID. Try 'help %s' for more information.is@Please provide the knowledge base solution ID (or 'q' to exit): tq(RR
tNonet
solutionIDt_argsRtis_interactivet	raw_inputt	Exceptiontstrtstrip(Rtmsgtline((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pyt_check_solution_idYs	
		cCs|jdS(N(R (R((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pyt
validate_argsnscCsd}t|_i|_d}y@tj}|jj|j}|j	|s`t
nWn}t
k
ry4|jj|j}|j|st
nWqt
k
r}tdt|}|GHtjtj|qtk
rG}td|j}|GHtjtj||jdkrAtjnqtk
r}td}|GHt|jd}|dGHtjtj|qt
k
rtd|j}|GHtjtj|qXnXdS(Ns	ERROR: %ss?Unable to fulfill request with support services API. Reason: %stUnauthorizedsZProblem connecting to the support services API.  Is the service accessible from this host?s, is$Unable to find a KB with an ID of %s(RRRt	_sectionst	apihelpertget_apit	solutionstgetRt_parse_solution_sectionsRtarticlest_parse_article_sectionsRRRtloggertlogtloggingtWARNINGRtreasonRtremove_userRtsplit(Rt	kb_objecttapiteveRtreterrmsgtemg((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pytpostinitrsP	
	

	
	
cCsd}x7|jD],}|j|jkr||j|7}qqWy|jddGHWnItk
r}tjtj	|ddl
}|j|jdGHnXdS(NusUTF-8treplacei(Rtdisplay_texttALLR#tencodeRR+R,R-R.tsystgetdefaultencoding(RtdoctoptteR=((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pytnon_interactive_actionscCs|j|jkrtd}x7|jD],}|j|jkr"||j|7}q"q"Wtj|jddddn,|j|}tj|jdddddS(NusUTF-8R9tcmdsless -R(R:R;RR#tpydoct	pipepagerR<(Rtdisplay_optionR?R@((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pytinteractive_actions

c
CsA|s
tSyd}|dtjtjtjf7}|dtjt|jtjtjf7}|d|j7}|dtj	|j
f7}|dtj|jf7}|dtj
|jf7}|jdtj}ttjd}|jj|||j|<|j}|dk	r|jdk	rd}|dtjtjtjf7}|dtjt|jtjtjf7}|d|j7}ttjd}|jj|||j|<n|j}|dk	r|jdk	rd}|dtjtjtjf7}|dtjt|jtjtjf7}|d|j7}ttjd}|jj|||j|<n|j}|dk	rX|jdk	rXd}|dtjtjtjf7}|dtjt|jtjtjf7}|d|j7}ttjd}|jj|||j|<n|j}|dk	r|jdk	rd}|dtjtjtjf7}|dtjt|jtjtjf7}|d|j7}ttjd}|jj|||j|<n|j }|dk	r|jdk	rd}|dtjtj!tjf7}|dtjt|jtjtjf7}|d|j7}ttj!d}|jj|||j|<nt|j"d}|jj|d|j|<Wn,t#d}	|	GHt$j%t&j'|	tSXt(S(	Nus
%s%s%s
s%s%s%s
s%s
s
%-10s  %s
s
RGs$ERROR: problem parsing the solution.()tFalseRtBOLDtTITLEtENDRtrulertMAX_RULEt	get_titletURLtget_viewURIt
CREATED_ONtget_createdDatetMODIFIED_ONtget_lastModifiedDateR9tostlinesepRRtappendR#t	get_issueRtget_texttISSUEtget_environmenttENVtget_resolutiont
RESOLUTIONt
get_rootCauset
ROOT_CAUSEtget_diagnosticStepstDIAGR;RR+R,R-R.tTrue(
RtsolR?tdisp_opttissuetenvtrestrctdiagR((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pyR(s		
												cCs |s
tSyd}|dtjtjtjf7}|dtjt|jtjtjf7}|d|j7}|dtj	|j
f7}|dtj|jf7}|dtj
|jf7}ttjd}|jj|||j|<|j}|dk	r|jdk	rd}|dtjtjtjf7}|dtjt|jtjtjf7}|d|j7}ttjd}|jj|||j|<nt|jd}|jj|d|j|<Wn,td}|GHtjtj|tSXtS(Nus
%s%s%s
s%s%s%s
s%s
s
%-10s  %s
RGs#ERROR: problem parsing the article.(RHRRIRJRKRRLRMRNRORPRQRRRSRTRRRWR#tget_bodyRRYRZR;RR+R,R-R.Rc(RtartR?RetbodyR((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pyR*0sR		
				N(t__name__t
__module__R
RR;RRR#RtclassmethodRRRRRRR R!R8RBRGR(R*(((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pyR	#s$						,		s(tcollectionsRt(redhat_support_lib.infrastructure.errorsRRt(redhat_support_tool.helpers.confighelperRRtredhat_support_tool.pluginsRRt%redhat_support_tool.helpers.constantsRtredhat_support_tool.helpersRRURDt%redhat_support_tool.helpers.apihelperthelpersR$R-t
__author__t	getLoggerR+R	(((sB/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/kb.pyt<module>s