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

fc@sddlmZddlmZmZddlmZddlmZddlm	Z	m
Z
ddlmZddl
mZddlmZdd	lmZdd
lZdd
ljjZdd
lZdZejdZd
e	fdYZd
S(i(tdeque(tRequestErrortConnectionError(t_(tEmptyValueError(tInteractivePlugintObjectDisplayOption(t	Constants(tcommon(tLaunchHelper(t
GetAttachmentNs&Spenser Shumaker <sshumake@redhat.com>s+redhat_support_tool.plugins.list_attachmenttListAttachmentscBseZdZedZedZdZdZdZ	dZ
edZedZ
edZdZdZdZd	Zd
ZdZdZdd
ZdZRS(tlistattachmentssDisplay all attachmentssNo more attachments to displaycCs
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(R(tcls((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.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
        sHUse the '%s' command to list attachments for the specified support case.(Rtplugin_name(R
((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pytget_desc9s		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 12345678(RR(R
((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pyt
get_epilogEs	cCs
tdS(NsU
Type the number of the attachment to download or 'e' to return to the previous menu.(R(tself((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pytget_intro_textSscCs
tdS(NsSelect an attachment: (R(R((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pytget_prompt_textWscCs|jS(N(t
_submenu_opts(R((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pytget_sub_menu_optionsZscCstd|j}d|_|jr8|jd|_netjrttd}t|j	}|dkrt
n||_n|GHt
|dS(NsERROR: %s requires a case.is0Please provide the case number(or 'q' to exit): tq(RRtNonetcaset_argsRtis_interactivet	raw_inputtstrtstript	Exception(Rtmsgtline((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pyt_check_case_number]s	
		cCs|jdS(N(R"(R((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pyt
validate_argsoscCst|_i|_d}y@tj}|jj|j|_	|j
sZtnWn.tk
r}t
dt|}|GHtjtj|ntk
r}t
d|j}|GHtjtj||jdkrtjnntk
rT}t
d}|GHt|jd}|dGHtjtj|n8tk
rt
d}|GHtjtj|nXdS(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, isUnable to list attachments(RRt	_sectionsRt	apihelpertget_apitattachmentstlistRtaAryt_parse_casesRRRRtloggertlogtloggingtWARNINGRtreasonRtremove_userRtsplit(RtapiteveR treterrmsgtemg((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pytpostinitssB		

	
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=((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pytnon_interactive_actionscCs|j|jkrtd}x7|jD],}|j|jkr"||j|7}q"q"Wtj|jddddn5d}|j}t	t
}|jd|j|fdS(NusUTF-8R9tcmdsless -Rs-c %s -u %s(
R:R;RR%tpydoct	pipepagerR<Rt
stored_objR	R
trunR(Rtdisplay_optionR?R@tuuidtlh((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pytinteractive_actions
	cCsyx|jD]}d}|dtjtj|jf7}|dtj|jf7}|dtj|j	f7}|dtj
|jf7}|dtjtj
|jf7}|dtj|jf7}|dtj|jf7}|dtjtdtjtjf7}d|j	|j|jtj
|jf}t|d|j}|jj|||j|<q
WWn,td}|GHtjtj|t SXt!S(	sB
        Use this for non-interactive display of results.
        us
%-14s  %-60s
s%-14s  %-60ss


%s%s%s

t-s%-24s  %-36s  %-40s  %sRKs'ERROR: problem parsing the attachments.("R*Rt
ATTACH_CREATERtiso8601tolocaltget_createdDatetATTACH_CREATE_BYt
get_createdBytATTACH_FILE_NAMEtget_fileNametATTACH_DESCRIPTIONtget_descriptiont
ATTACH_LENGTHtget_friendly_file_lengthtget_sizetUUIDtget_uuidtURLtget_linktBOLDRtMAX_RULEtENDRRtappendR%RR,R-R.R/tFalsetTrue(RtvalR?t
disp_opt_texttdisp_optR ((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pyR+sHN(t__name__t
__module__RRR;tend_of_entriesRRR%RR*tclassmethodRRRRRRR"R#R8RBRKR+(((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pyR%s&						$	(tcollectionsRt(redhat_support_lib.infrastructure.errorsRRt(redhat_support_tool.helpers.confighelperRRtredhat_support_tool.pluginsRRt%redhat_support_tool.helpers.constantsRtredhat_support_tool.helpersRt(redhat_support_tool.helpers.launchhelperR	t*redhat_support_tool.plugins.get_attachmentR
RDt%redhat_support_tool.helpers.apihelperthelpersR&R.t
__author__t	getLoggerR,R(((sP/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/list_attachments.pyt<module>s