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

fc@sddlmZddlmZddlmZmZddlmZddlm	Z	ddl
mZmZddl
mZddlmZdd	lmZdd
lmZddlmZddljjZddlZddlZd
ZdZejdZdefdYZdS(i(tOption(tdeque(tRequestErrortConnectionError(t_(tEmptyValueError(tInteractivePlugintObjectDisplayOption(t	Constants(tcommon(tconfighelper(tLaunchHelper(tKbNs%Keith Robertson <kroberts@redhat.com>s&Spenser Shumaker <sshumake@redhat.com>s"redhat_support_tool.plugins.searchtSearchcBspeZdZedZedZedZiedd6edd6edd	6ZeZ	dZdZdZ
d
ZejjddZesd
n	eeZedkrdneZedZedZedZedZdZdZdZdZdZdZdZ dZ!ddZ"dZ#dZ$dZ%RS( tsearchs%s of %s solutions displayed. Type 'm' to see more, 'r' to start from the beginning again, or '?' for help with the codes displayed in the above output.sNo more solutions to displays>More solutions may be available. Type 'm' to try and find mores6Work In Progress: This solution is a Work in Progress.tWIPsQUnverified: This solution has not yet been verified to work by Red Hat customers.tUNVsVerified: This solution has been verified to work by Red Hat Customers and Support Engineers for the specified product version(s).tVERitoptiontmax_resultsii2cCs
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 [options] <keywords>(R(tcls((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pyt	get_usageJs	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
        sUse the '%s' command to search the entire knowledge base for solutions with given keywords, a log message, program configuration variables, etc.(Rtplugin_name(R((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pytget_descUs		cCstd|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
        sRExamples:
  - %s RHEV
  - %s -s Starting osa-dispatcher: RHN 9899 Traceback caught(RR(R((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pyt
get_epilogbscCs.tdddddtdtddd	gS(
Ns-ss	--summarytdesttsummarytdefaultthelps2Display summary information about matched articlestactiont
store_true(RtFalseR(R((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pytget_optionsrscCstd|j}|jstjrttd}t|j}|dkrdtnt|jr||_qq|GHt|ndS(Ns"ERROR: %s requires text to search.s4Please provide the text to search (or 'q' to exit): tq(	RRt_lineR	tis_interactivet	raw_inputtstrtstript	Exception(tselftmsgtline((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pyt
validate_argsxs	
	cCs
tdS(NsO
Type the number of the solution to view or 'e' to return to the previous menu.(R(R(((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pytget_intro_textscCs
tdS(NsSelect a Solution: (R(R(((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pytget_prompt_textscCs|jS(N(t
_submenu_opts(R(((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pytget_sub_menu_optionsscCst|j|jks?t|jdks?|j|jkrCtS|j}||krd|}ni|d6|jd6}|j|7_|j|}t|dkrtS|jj||j|t	S(Nitlimittoffset(
tlent_solAryt_nextOffsett_MAX_OFFSETRt
_get_limitt_get_solutionstextendt_parse_solutionstTrue(R(tnum_optionsR0t
searchoptst
newresults((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pytget_more_optionss	
cCsrtddtdg}x|D]}|GHq"Wx-|jjD]}d||j|fGHqAWtj|dS(NseRed Hat Support assigns a state with all knowledge solutions, which is displayed in the above output.tsThe current states are:s	  %s - %s(Rtstate_explanationstkeysR	tdo_help(R(R*tdoclinestdoctstate((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pyRBs	
	cCst|_i|_i|jd6dd6}|j|_|j||_|j|jstd}|GHt	j
tj|t
ntjsx|j|jrqqWndS(NR0iR1sUnable to find solutions(RR.t	_sectionst_limitR4R7R3R9RtloggertlogtloggingtWARNINGR'R	R#R>(R(R<R)((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pytpostinits	cCsd}x"|jD]}||j|7}qWy|jddGHWnItk
r}tjtj|ddl}|j|j	dGHnXdS(NusUTF-8treplacei(
R.RFtencodeR'RHRIRJRKtsystgetdefaultencoding(R(RDtoptteRO((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pytnon_interactive_actionscCsCd}y&|j}tt}|j|WntnXdS(N(tNonet
stored_objRRtrunR'(R(tdisplay_optiontsolution_idtlh((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pytinteractive_actions	c	Csd}yntj}|j}|jjdsB|jjdr]|jjdj}n|jj|d|SWn.t	k
r}t
dt|}|GHtj
tj|ntk
r}t
d|j}|GHtj
tj||jdkrtjnntk
rm}t
d}|GHt|jd	}|d
GHtj
tj|n8tk
rt
d}|GHtj
tj|nXdS(Ns-s s -ss-sR<s	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, isUnable to find solutions(RTt	apihelpertget_apiR"t
startswithtendswithR&t	solutionstlistRRR%RHRIRJRKRtreasonR	tremove_userRtsplitR'(	R(R<tapit
search_stringteveR)treterrmsgtemg((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pyR7s@	$	

	
cCsd}yxz|D]r}d}|dtj|jf7}d}|jdr|j}|rdj|jddjdd!}|d7}n|dtj	|f7}n|dtj
|jf7}|jdd	!j
}|jj|d
}|td|7}|dtj|jf7}|j}|rU|dtj|f7}n,|dtjtjd
d
|jf7}|dtjtdtjtjf7}tjtjjddr|j dj
}	d|j||	|jf}
nd|j||jf}
|jdrM|
dtj	|f7}
nt!|
d|j}|j"j#|||j$|<qWWn,td}|GHt%j&t'j(|t)SX|rt*St)S(sB
        Use this for non-interactive display of results.
        us%-12s %-60s
Rt s
iids...iR?sState:       %s
s%-12s %-60ss	api\.|/rss


%s%s%s

t-Rtponiess[%7s:%s:%s] %ss[%7s:%s] %ss
 *** %s %sRZs%ERROR: problem parsing the solutions.N(+RTRtTITLEt	get_titlet_optionstget_abstracttjoinRMRdtCASE_SUMMARYtIDtget_idtget_kcsStatetupperR@tgetRtMODIFIED_ONtget_lastModifiedDatetget_view_uritURLRhtsubtget_resource_uritBOLDR%tMAX_RULEtENDR	tstr_to_boolR
tget_config_helpertget_ModerationStateRR.tappendRFRHRIRJRKRR:(R(tsolArytdisp_opttvalRDRtkcsStatetkcsStateExplanationtvuritpublished_statet
disp_opt_textR)((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pyR9sj

(
!
cCs1|j}|j|j}||kr)|S||S(N(RGR5R4(R(R0t	remaining((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pyR6Os	N(&t__name__t
__module__RRtpartial_entriestend_of_entriestmore_entries_maybeR@Rthelp_is_optionsRTR.RFR3R4R
RRxR5tintRGtclassmethodRRRR R+R,R-R/R>RBRLRSRZR7R9R6(((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pyR
(s>

										#	C(toptparseRtcollectionsRt(redhat_support_lib.infrastructure.errorsRRt(redhat_support_tool.helpers.confighelperRRtredhat_support_tool.pluginsRRt%redhat_support_tool.helpers.constantsRtredhat_support_tool.helpersR	R
t(redhat_support_tool.helpers.launchhelperRtredhat_support_tool.plugins.kbRt%redhat_support_tool.helpers.apihelperthelpersR\RJRht
__author__t	getLoggerRHR
(((sF/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/search.pyt<module>s"