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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyo
�
��Tc@s!ddlmZddlmZmZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZddlmZdd	lZdd	ljjZdd	ljjZdd	ljjZdd	lZdd	lZdd	lZd
Zejd�Z defd
��YZ!d	S(i����(tOption(tRequestErrortConnectionError(tEmptyValueErrort_(tLaunchHelper(t	Constants(t
GenericPrompt(tPlugin(t
AddAttachmentNs&Spenser Shumaker <sshumake@redhat.com>s$redhat_support_tool.plugins.add_casetOpenCasecBs�eZdZd
Zd
Zd
Zd
Zed��Z	ed��Z
ed��Zed��Zd�Z
d�Zd�Zd�Zd	�Zd
�Zd�Zd�ZRS(topencasecCs
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 -s SUMMARY -p PRODUCT -v VERSION -d DESCRIPTION [options](R(tcls((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt	get_usage0s	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
        s0Use the '%s' command to open a new support case.(Rtplugin_name(R((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pytget_desc<s		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
        sWExamples:
  - %s -s Summary -p Red Hat Enterprise Virtualization -v 3.0 -d description
(RR(R((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt
get_epilogHscCstdddddtd�dd �tdd	dd
dtd�dd �tdd
dddtd�dd �tdddddtd�dd �tdddddtd�dd �tdddddtd�dd �tdddddtd�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-ps	--producttdesttproductthelps7The product the case will be opened against. (required)tdefaults-vs	--versiontversionsFThe version of the product the case will be opened against. (required)s-ss	--summarytsummarys!A summary for the case (required)s-ds
--descriptiontdescriptions&A description for the case. (required)s-Ss
--severitytseveritys$The severity of the case. (optional)s-as--attachmentt
attachments6Add an attachment to the newly opened case. (optional)s-gs--casegroupt	casegroups6Add this case to the designated case group. (optional)N(RRtNone(R((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pytget_optionsWs*cCs�td�|j}d|_t}|jds=tj�r)tj�|_tj	|j�x�t
r%ttd��}t|�j
�dkr�t��nyt|�}Wntd�GHq]nX|tdt|j�d�kr|dkr|j|dj�|jd<t
}Pq]td�GHq]WqL|GHt|��ntj�|_|s�t}xS|jD]H}|j�j�|jdj�krbt
}|j�|jd<PqbqbW|s�td�}|GHt|��q�ndS(	NsERROR: %s requires a product.Rs*Please select a product (or 'q' to exit): tqs!ERROR: Invalid product selection.its ERROR: Invalid product provided.(RRRt_productsArytFalset_optionstcommontis_interactivetget_productstprint_productstTruet	raw_inputtstrtstript	Exceptiontinttrangetlentget_nametlower(tselftmsgtbeenVerifiedtlinetinArrayR((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt_check_product�sJ	
	
	"%cCs�td�|j}t}d}x:|jD]/}|jd|j�kr)|j�}Pq)q)W|jdsYtj	�rEtj
|�x�trAttd��}t
|�j�dkr�t��nyt|�}Wntd�GHq�nX|tdt|�d�kr3|dkr3||d|jd<t}Pq�td�GHq�WqY|GHt|��n|s�t}xD|D]<}|j�|jdj�krlt}||jd<PqlqlW|s�td	�}|GHt|��q�ndS(
NsERROR: %s requires a version.RRs*Please select a version (or 'q' to exit): Rs!ERROR: Invalid version selection.iRs ERROR: Invalid version provided.(RRR RRR!R.tget_versionsR"R#tprint_versionsR&R'R(R)R*R+R,R-R/(R0R1R2tversionsRR3R4R((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt_check_version�sL	


	+

cCs�td�|j}|jds�tj�r�x�tr�ttd��}yt|�j�}Wntd�GHnXt|�j�dkr�t	��n|dkr�td�GHq/||jd<Pq/Wq�|GHt	|��ndS(NsERROR: %s requires a summary.Rs)Please enter a summary (or 'q' to exit): s!ERROR: Invalid summary selection.RR(
RRR!R"R#R&R'R(R)R*(R0R1R3((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt_check_summary�s$	

	
cCs�td�|j}|jds�tj�r�x�tr�g}y,td�GHxtre|jt��qLWWq/tk
r�t	dj
|��j�}|dkr�td�GHq�|jd�|jd<Pq/Xq/Wq�|GHt
|��ndS(Ns!ERROR: %s requires a description.RsCPlease enter a description (Ctrl-D on an empty line when complete):s
RsERROR: Invalid description.tutf_8(RRR!R"R#R&tappendR'tEOFErrorR(tjoinR)tdecodeR*(R0R1t	userinputR((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt_check_descriptions&	

		
cCsltd�}|jds�tj�rhtj�}tj|�x�tr�ttd��}t|�j	�dkr}t
��nyt|�}Wntd�GHnX|tdt
|�d�kr�|dkr�||d|jd<PqAtd�GHqAWqhnmt}xJtj�D]<}|jdj�|j�krt}||jd<PqqW|shtd�}|GHndS(	Ns!ERROR: Invalid severity selectionRs+Please select a severity (or 'q' to exit): Rs"ERROR: Invalid severity selection.iRs"ERROR: Invalid severity specified.(RR!R"R#tget_severitiestprint_severitiesR&R'R(R)R*R+R,R-R R/(R0R1t
severitiesAryR3tmatchR((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt_check_severitys4

	+
cCs5td�}|jdsztj�r1ttd��}t|�j�j�dkrwtj�}tj	|�xt
rpttd��}t|�j�dkr�t��nyt|�}Wntd�GHnX|t
dt|�d�krb|d	krb||d|jd<||dj�|jd
<tjtjd|jdj�|jd
f�Pqqtd�GHqqWqwq1n�t}x�tj�D]�}|jdj�|j�j�kr�t
}|j�|jd<|j�|jd
<tjtjd|jd|jd
f�Pq�q�W|s1td
�}|GHndS(Ns#ERROR: Invalid case group selectionRs:Would you like to assign a case group to this case (y/N)? tys+Please select a severity (or 'q' to exit): Rs"ERROR: Invalid severity selection.iRtcasegroupnumbers!Casegroup(%s) casegroupnumber(%s)s$ERROR: Invalid case group selection.s$ERROR: Invalid case group specified.(RR!R"R#R'R(R)R/t
get_groupstprint_groupsR&R*R+R,R-t
get_numbertloggertlogtloggingtINFOR.R (R0R1R3t	groupsAryREtgroup((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt_check_case_group@sN

	+
cCs@|j�|j�|j�|j�|j�|j�dS(N(R5R9R:RARFRR(R0((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt
validate_argsps




cCs�d}y�tj�}|jj�}|jd|_|jd|_|jd|_|jd|_	|jd|_
|jdr�|jd|_ntj
�r^ttd��}t|�j�j�}|d	kr^|jj|�}tj|�\}}tt�}|jd
|dtd��ttd
��}|j�dkr[td�GHdSq^n|jj|�}|j�dkr�td�}	|	GHt|	��n|j�|_dtj tdtj!�tj"fGHtd�|j}	|	GHt#j$t%j&|	�|jdrTtt'�}|jd|jt(j)j*|jd�|jdf�nt(j+�dkrIt,j-j.td�|j�t�}t|�j�}|d	krdt/j0ddgdt/j1dt/j2�}
|
j3�dj4d�}xY|D]N}d|kr�t|�j�}
tt'�}|jd|j|
f�Pq�q�Wqdntd�|j|jfGH|jds�ttd �|j�}t|�j�}|d	kr�tt'�}|jd!|j�q�nWn�t5k
r}td"�t|�}	|	GHt#j$t%j6|	��n�t7k
rU}td#�|j8}	|	GHt#j$t%j6|	��not9k
r�td$�}	|	GHt#j$t%j6|	��n8tk
r�td%�}	|	GHt#j$t%j6|	��nXdS(&NRRRRRRRHsVWould see if there is a solution to this problem before opening a support case? (y/N) RGRtprompts-Selection (q returns to case creation menu): s5Would you still like to open the support case? (Y/n) tns"Thank you for using Red Hat Accesss.ERROR: There was a problem creating your case.s%s%s%st-s.Support case %s has successfully been opened.
Rs-c %s -d '[RHST] File %s ' %sisgWould you like Red Hat Support Tool to automatically generate and
attach a SoS report to %s now? (y/N) t	sosreports--batchtstdouttstderrs
s.tar.s-c %s %ss�Please attach a SoS report to support case %s. Create a SoS report as
the root user and execute the following command to attach the SoS report
directly to the case:
 redhat-support-tool addattachment -c %s <path to sosreport>
s:Would you like to attach a file to %s at this time? (y/N) s-c %ss	ERROR: %ss5Unable to connect to support services API. Reason: %ssZProblem connecting to the support services API.  Is the service accessible from this host?sUnable to create case.(:Rt	apihelpertget_apitimtmakeCaseR!RRRRRtfolderNumberR"R#R'RR(R)R/tproblemstdiagnoseCasetrecommendationpromptertgenerate_metadataRRtruntcasestaddtget_caseNumberR*t_caseNumberRtBOLDtMAX_RULEtENDRLRMRNROR	tostpathtbasenametgeteuidtsysRXtwritetsubtPopentPIPEtSTDOUTtcommunicatetsplitRtWARNINGRtreasonR(R0tapitcaseR3trecommendationst	recprompttrecdoctlhtcsR1tptoutputtoutRltevetre((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pytnon_interactive_actionxs�


		

		


	


N(t__name__t
__module__RRtcommentRRRgtclassmethodR
RRRR5R9R:RARFRRRSR�(((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyR
)s"5	0	0			!	0	("toptparseRt(redhat_support_lib.infrastructure.errorsRRt(redhat_support_tool.helpers.confighelperRRt(redhat_support_tool.helpers.launchhelperRt%redhat_support_tool.helpers.constantsRt4redhat_support_tool.helpers.genericinteractivepromptRtredhat_support_tool.pluginsRt*redhat_support_tool.plugins.add_attachmentR	Rkt%redhat_support_tool.helpers.apihelperthelpersRZt"redhat_support_tool.helpers.commonR"t2redhat_support_tool.helpers.recommendationprompterRat
subprocessRqRNRot
__author__t	getLoggerRLR
(((sI/usr/lib/python2.7/site-packages/redhat_support_tool/plugins/open_case.pyt<module>s"

https://t.me/AnonymousX5 - 2025