HEX
Server: Apache/2.4.6 () OpenSSL/1.0.2k-fips PHP/8.3.8
System: Linux gateway.rmc-logistics.net 4.1.12-124.48.6.el7uek.x86_64 #2 SMP Tue Mar 16 14:57:50 PDT 2021 x86_64
User: apache (48)
PHP: 8.3.8
Disabled: NONE
Upload Files
File: //lib/python2.7/site-packages/sos/sosreport.pyo
�
�fc@s+dZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddlZddl
mZmZddlmZddlZddlZddlmZmZddlZddlmZdd	lmZdd
lmZmZddlZddlmZddl m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*ddl+Z+dd
l,m-Z-m.Z.ej/ej0fZ1e2dd�Z3d�Z4de5fd��YZ6de
fd��YZ7dddgZ8d�Z9de5fd��YZ:d�Z;dS(sm
Gather information about a system and report it using plugins
supplied for application-specific information
i����N(tdatetime(tArgumentParsertAction(tImporterHelpertSoSTimeoutError(trmtree(tThreadPoolExecutortTimeoutError(t_sos(t__version__(t
_arg_defaultst
SoSOptions(tTarFileArchive(
tReporttSectiontCommandt
CopiedFiletCreatedFiletAlerttNotetPlainTextReportt
JSONReportt
HTMLReport(tziptinputs, cCs�g}|}|r%t|�d}nd}xX|D]P}t|�t|�t|�dkrt|j|�|}n|||}q2W|t|�|kr�|t|� }n|j|�|S(Nt tiH(tlentappend(t
first_linetitemstindenttseptlinestlinetnewlinetitem((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_format_list4s
&
	
cCstjdj|�d�S(s� This function will format --since arg to append 0s if enduser
    didn't. It's used in the _get_parser.
    This will also be a good place to add human readable and relative
    date parsing (like '2 days ago') in the future s{:<014s}s%Y%m%d%H%M%S(Rtstrptimetformat(tdate((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
_format_sinceFstTempFileUtilcBs#eZd�Zd�Zd�ZRS(cCs||_g|_dS(N(ttmp_dirtfiles(tselfR+((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt__init__Ps	cCsGtjd|j�\}}tj|d�}|jj||f�|S(Ntdirsw+(ttempfiletmkstempR+tostfdopenR,R(R-tfdtfnametfobj((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytnewTscCsxxh|jD]]\}}y|j�|j�Wntk
rAnXytj|�Wq
tk
rfq
Xq
Wg|_dS(N(R,tflushtcloset	ExceptionR2tunlink(R-R5tf((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytclean[s


(t__name__t
__module__R.R7R=(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR*Ns		t
SosListOptioncBseZdZdd�ZRS(s0Allow to specify comma delimited list of pluginscCsdg|jd�D]}|^q}t||j�rM|t||j�7}nt||j|�dS(Nt,(tsplittgetattrtdesttsetattr(R-tparsert	namespacetvaluest
option_stringtoptR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt__call__ms"N(R>R?t__doc__tNoneRK(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR@istautotalwaystneverc
Cs5d}td|�}|jddt�|jdddddd	d
tdd�|jd
ddddd
tdd�|jdddddd
d�dtdd�|jdddddd
tdd�|jdddddd
tdd�|jddddddd�|jdddddd dd!d
td �|jd"dtdddd#d
d$dd%�|jd&dddd'dd(�|jd)d*dtdddd+d
d,�|jd-dddd.�|jd/dddd0d
tdd1�|jd2d3dddd4dtdd5d
g�|jd6d7dddd8dtdd9d
g�|jd:d;dddd<dd=�|jd>d?dddd@d
tddA�|jdBddddC�|jdDddddEd
tddF�|jdGddddHdt	d
tdHddI�|jdJdKddddLdtddMd
g�|jdNddddOddPd
t�|jdQddd
tddRddS�|jdTd
tddUddddV�|jdWdtddd
d,ddX�|jdYdZdddd[dtdd\d
g�|jd]dddtdd^d
d_�|jd`d
d�dda�|jdbdcddddddtd
gdde�|jdfdgddddhd
tddi�|jdjdkddddlddmd
d��|jdnddddddo�|jdpddddqddrd
d��|jdsdtdduddvd
tdvddw�f|jdxddddyd
tddz�|jd{d|dd}d
td}dd~�|jdd�dddd�dd�d
d�dt	�|jd�dddd�d
tdd��|j
�}|jd�dtdddd��|jd�dtdddd��|j
�}|jd�dd��|jd�dd��|S(�s Build ArgumentParser contents�%(prog)s [options]

Some examples:

enable dlm plugin only and collect dlm lockdumps:
  # sosreport -o dlm -k dlm.lockdump

disable memory and samba plugins, turn off rpm -Va collection:
  # sosreport -n memory,samba -k rpm.rpmva=offtusagetactiontextends-as--alloptionst
store_trueRDt
alloptionstdefaultthelps%enable all options for loaded pluginss
--all-logstall_logss-collect all available logs regardless of sizes--sincetstoretsincettypesbEscapes archived files older than date. This will also affect --all-logs. Format: YYYYMMDD[HHMMSS]s--batchtbatchs(batch mode - do not prompt interactivelys--buildtbuilds;preserve the temporary directory and do not package resultss	--case-idtcase_idsspecify case identifiers-cs--chroottchrootsHchroot executed commands to SYSROOT [auto, always, never] (default=auto)s
--config-filetconfig_files
/etc/sos.confs$specify alternate configuration files--debugtdebugs6enable interactive debugging using the python debuggers--descs
--descriptionsDescription for a new presetRs	--dry-runs#Run plugins but do not collect datas--experimentaltexperimentalsenable experimental pluginss-es--enable-pluginst
enablepluginssenable these pluginss-ks--plugin-optiontplugoptss7plugin options in plugname.option=value format (see -l)s--labels--nametlabels"specify an additional report labels-ls--list-pluginstlist_pluginss)list plugins and available plugin optionss--list-presetss#display a list of available presetss--list-profilest
list_profilessBdisplay a list of available profiles and plugins that they includes
--log-sizetlog_sizes)limit the size of collected logs (in MiB)s-ns--skip-pluginst	nopluginssdisable these pluginss--no-reporttnoreports disable plaintext/HTML reportings
--no-env-varstno_env_varss$Do not collect environment variabless
--no-postproctno_postprocsDisable all post-processings--notesBehaviour notes for new presets-os--only-pluginstonlypluginssenable these plugins onlys--presetsA preset identifierRNs--plugin-timeoutsset a timeout for all pluginss-ps	--profiletprofiless)enable plugins used by the given profiless-qs--quiettquietsonly print fatal errorss-ss	--sysroottsysroots(system root directory path (default='/')s--ticket-numbersspecify ticket numbers	--tmp-dirR+s%specify alternate temporary directorys-vs	--verbosetcountt	verbositysincrease verbositys--verifytverifys+perform data verification during collections-zs--compression-typetcompression_typesDcompression technology to use [auto, gzip, bzip2, xz] (default=auto)s-ts	--threadstthreadss7specify number of concurrent plugins to run (default=4)is--allow-system-changestallow_system_changessJRun commands even if they can change the system (e.g. load kernel modules)s--add-presets#Add a new named command line presets--del-presets$Delete the named command line presets
--encrypt-keys.Encrypt the final archive using a GPG key-pairs--encrypt-passs*Encrypt the final archive using a passwordN(RtregisterR@tadd_argumenttFalseRMR)R
tstrtinttadd_mutually_exclusive_group(tusage_stringRFt
preset_grptencrypt_grp((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_get_parserxs�









t	SoSReportcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ed	��Zd
d�Z
d�Zd6d6d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!d!d"�Z#d#�Z$d$�Z%d%�Z&d&�Z'd'�Z(d(�Z)d)�Z*d*�Z+d+�Z,d,�Z-d-�Z.d.�Z/d/�Z0d0�Z1d1�Z2d2�Z3d3�Z4d4�Z5d5�Z6RS(7sThe main sosreport classc	Csg|_g|_g|_t�|_d|_d|_||_d|_	d|_
t|_d|_
y)ddl}|j|j|j��Wntk
r�nX|j�t�}t�j|jg��|_x,|jD]!}|jdkr�d|_q�q�Wt�j|j|��}|jj|�t�j||jj�|_|jj|j�|j�y"tj j!d|jj	�|_"Wnt#k
r�|j$d�nX|j"j%�|_&|jj
t'dkr6|j"j(|jj
�|_
|j
s6t)j*j+d|jj
�|j"j,�|_
t-|j_.q6n|j
sT|j"j,�|_
n|jj|j
j�t/j0j1|j"j2|jj3��}t/j0j4|�s�t/j5|t/j6�r�d|}|d	7}t)j*j+|�|j$d
�n||_
t7j8ddd
|j
�|_9t:|j9�|_|j;�|j<�d}|j"j=�}|jj	rqd}|jj	|_	n0|j"j>�r�|t/j?kr�d}||_	n|j@jAd|j	|f�|jjBtCkr|j@jDd|jjB�tEjF�|jjG�|j$d
�ndS(Nt/i����s==SUPPRESS==RpitpresetsUnknown preset: '%s'
stemporary directory %s s"does not exist or is not writable
itprefixssos.R/RVtcmdlinetpolicysset sysroot to '%s' (%s)sinvalid chroot mode: %s(Htloaded_pluginstskipped_pluginstall_optionstsettenv_varsRMtarchivet
tempfile_utilt_argsRptsys_tmpRytexit_processR�tsignaltSIGTERMtget_exit_handlerR:tprint_headerR�Rt	from_argst
parse_argstoptst_actionsRVtmerget	from_fileR`tfileoptst
_set_debugtsostpoliciestloadR�tKeyboardInterruptt_exittis_roott_is_rootR
tfind_presettsyststderrtwritetprobe_presettTruetlist_presetsR2tpathtabspathtget_tmp_dirR+tisdirtaccesstW_OKR0tmkdtempttmpdirR*t_set_directoriest_setup_loggingthost_sysroottin_containerR tsoslogRaR_tchroot_modesterrortloggingtshutdownR=(	R-targsR�RFtoptiontcmd_optsttmptmsgR�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR.s�										

	

"
		$

	



cCsdtdtf�GHdS(Ns
%s
ssosreport (version %s)(t_R	(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR�vscCsai	|jd6|jd6|jd6|jd6|jd6|jd6|jd6|jjd6|jd	6S(
NtcmddirtlogdirtrptdirR�R�R�RpRrtcmdlineopts(	R�R�R�R�R�R�RpR�Rr(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytget_commonsys







cCs
|jj�S(N(R�R7(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
get_temp_file�scCs
i|jjs|jjr!tntd6|jjd6|jjd6}tjj|j|j	j
��}|jjdkr�|j	j�}|||j|j	|jj
||j�|_n-t||j|j	|jj
||j�|_|jj|jjr�tnt�dS(NtencrypttkeytpasswordRN(R�tencrypt_passtencrypt_keyR�RyR2R�tjoinR�R�tget_archive_nameRttget_preferred_archiveRuRpR�Rt	set_debugRa(R-tenc_optstarchive_nametauto_archive((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_set_archive�s 
cCsF|jj|jd�|jj|jd�|jj|jd�dS(Ni�(R�tmakedirsR�R�R�(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_make_archive_paths�scCsd|_d|_d|_dS(Ntsos_commandstsos_logstsos_reports(R�R�R�(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��s		cCs1|jjr$|jt_t|_n	t|_dS(N(R�Rat
_exceptionR�t
excepthookR�t
raise_pluginsRy(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��sc	Csottd�stjj�r5tj|||�n6tj|||dddtj�tj	�t
j�dS(s* Wrap exception in debugger if not in tty tps1tlimititfileN(thasattrR�R�tisattyt__excepthook__t	tracebacktprint_exceptiontstdouttsixtprint_tpdbtpm(tetypeteval_tetrace((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��s

icCst|��dS(N(t
SystemExit(R-R�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��scs�fd�}|S(Ncst�_�j�dS(N(R�R�R�(tsignumtframe(R-(s1/usr/lib/python2.7/site-packages/sos/sosreport.pytexit_handler�s	((R-R�((R-s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��scCs�|js|jr]tj�\}}}tj|||dtj�tj�t	j
|�n|r||r||j||�ndS(NR�(R�R�R�texc_infoR�R�R�R�R�R�tpost_mortemt_log_plugin_exception(R-tplugnametfuncR�tvalttb((s1/usr/lib/python2.7/site-packages/sos/sosreport.pythandle_exception�s
cCsdtjd�|_|jjtj�|j�|_tj|j�}|jtj	d��|jtj
�|jj|�|jj
s�tjtj�}|jtj	d��|jjr�|jjdkr�|jtj�|jtj�nQ|jjr2|jjdkr2|jtj
�|jtj�n|jtj�|jj|�tjtj�}|jtj	d��|jtj�|jj|�ntjd�|_|jjtj
�|j�|_tj|j�}|jtj	d��|jj|�|jj
s`tjtj�}|jtj	d��|jtj
�|jj|�ndS(NR�s&%(asctime)s %(levelname)s: %(message)ss%(message)siitsos_ui(R�t	getLoggerR�tsetLeveltDEBUGR�tsos_log_filet
StreamHandlertsetFormattert	FormattertINFOt
addHandlerR�RoR�R�RrtWARNINGR�tERRORtui_logtsos_ui_log_file(R-tflogtconsoletconsole_errtui_fhandlert
ui_console((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��sF

cCs~t|dd�r=|jj|jdtjjdd��nt|dd�rz|jj|jdtjjdd��ndS(NR�RDR�ssos.logRsui.log(	RCRMR�tadd_fileR�R2R�R�R(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
_add_sos_logsscCs�|jj}t|jj�s"tSt|d�s5tS|rU|j|j��rUtSt	g|jD]}||jjk^qb�S(NRn(
R�RmRRnR�R�Ryt_is_not_specifiedtnametany(R-tplugin_classRmtp((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_in_profilescCs||jjkS(N(R�Ri(R-tplugin_name((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_skippedscCs;||j��j�o:||jjko:||jjkS(N(R�t
check_enabledR�RcRm(R-RtpluginClass((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_inactivescCs;||j��j�o:||jjko:||jjkS(N(R�tdefault_enabledR�RcRm(R-RR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_not_default scCs|jjo||jjkS(N(R�Rm(R-R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR%stunknowncCs/|jj|j�||j��|f�dS(N(R�RRR�(R-Rtreason((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_skip)s		cCs,|jj|j�||j��f�dS(N(R�RRR�(R-R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_load0s		cCs�tjj}ttj�}|j�}g|_t�|_t|j	j�}|j
j}g}|j	jr�|j
tjj�nt||�}|j
j}t|j	j�}	x�|D]�}
tjj|
�\}}yK|||�}
t|
�s�w�n|j
j|
�}||d|j	j�sn|jjtd�|
�|j	jdkrn|j|td��w�qnn|jr�|jr�|jjtd�|
�|j|td��w�n|jj
|�|j|�}|s�|j|td��w�n|j|�r#|j|td��w�n|j ||�rQ|j|td	��w�n|j!||�r|j|td
��w�nt"|d�r�|jj#|j�n|o�|}|j$|�r�|r�|j|td��w�nx-|jD]"}||	kr�|	j%|�q�q�W|j&|�Wq�t'k
r_}|jjtd
�|
|f�|j(�q�Xq�Wt|	�dkr�|jj)td�dj*|	��|j+�|j,d�ndS(NRbs%plugin %s does not validate, skippingisdoes not validates7plugin %s requires root permissionsto execute, skippings
requires roottexcludedtskippedtinactivetoptionalRns
not specifieds(plugin %s does not install, skipping: %ss+Unknown or inactive profile(s) provided: %ss, i(-R�tpluginst
import_pluginRtget_modulestplugin_namesR�RnRR�R�tvalid_subclassesRbRtExperimentalPluginttupletvalidate_plugintlistR2R�tsplitexttmatch_pluginR�twarningR�RrRt
requires_rootR�tinfoRRRRR�tupdateRtremoveRR:R�R�R�RgR�(R-R$thelperR#tusing_profilestpolicy_classest
extra_classestvalid_plugin_classesR*tremaining_profilestplugtplugbasetexttplugin_classesRt
in_profiletdefault_profiletite((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytload_plugins6s�	
			

cCsv|jjrrxc|jD]U\}}xFt|j|j�D]/\}}t|d�tkr8t|d<q8q8WqWndS(Ntenabled(	R�RUR�Rt	opt_namest	opt_parmsR[tboolR�(R-R�R9Rtparms((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_set_all_options�s
"cCs�|jjr�i}x|jjD]�}y|jd�\}}Wntk
rWt}n@X|j�dkrst}n$yt|�}Wntk
r�nXy|jd�\}}Wntk
r�|}t}nXy||Wntk
r�g||<nX||j	||f�qWx�|j
D]y\}}||krxT||D]H\}}|j||�sB|jj
d||f�|jd�qBqBW||=qqWx(|j�D]}|jj
d	|�q�W|j�r�|jj
d
�q�ndS(Nt=tofftdisabletdisabledtfalset.s#no such option "%s" for plugin (%s)isFWARNING: unable to set option for disabled or non-existing plugin (%s)R(RIRJRKRL(R�RdRBt
ValueErrorR�tlowerRyR{tKeyErrorRR�t
set_optionR�R�R�tkeys(R-R�RJR�R9R�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
_set_tunables�sH

	



cCs{ddl}xh|j|jj|jj|jj�D]?}|jd�d}||jkr4|jj	d|�q4q4WdS(Ni����RMisEWARNING: a non-existing plugin (%s) was specified in the command line(
t	itertoolstchainR�RmRiRcRBR&R�R�(R-RTtpluginR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_check_for_unknown_plugins�s	cCslxe|jD]Z\}}|j�\}}x9t||�D](\}}|jj||||f�q8Wq
WdS(N(R�tget_all_optionsRR�R(R-RRVtnamesRFtoptnametoptparm((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_set_plugin_options�s
cCs|jjd�t|j�rN|jjdt|j�t|j�f�n|jjdt|j��|jjd�dS(NRs %d profiles, %d pluginss %d profiles(RR0RR�Rn(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_report_profiles_and_plugins�s#cCs�|jr.|jr.|jjtd��dS|jr�|jjtd��|jjd�xP|jD],\}}|jjd||j�f�qgWn|jjtd��|jjd�|jr2|jjtd��|jjd�x@|jD]2\}}}|jjd|||j�f�q�Wn|jjd�|jro|jjtd��xE|jd	d	j	D]/}|jjd
|d	|d|df�qvW|jjd�|jjtd
��x�|jD]�\}}}}|dkr�q�nt
|d�tkr5|dtkr,d}q?d}n
|d}|jjd
|d|||df�q�Wn|jjtd��|jjd�t
|j�}	|	j�td|	dt�}
x"|
D]}|jjd|�q�W|j�dS(Nsno valid plugins founds,The following plugins are currently enabled:Rs	 %-20s %ssNo plugin enabled.s-The following plugins are currently disabled:s %-20s %-14s %ss4The following options are available for ALL plugins:is %-25s %-15s %siis+The following plugin options are available:ttimeouttpostprocRBtonRIRMtdescsNo plugin options available.s
Profiles: Rs %s(stimeoutspostproc(R�R�R�tfatalR�RR0tget_descriptionR�t_default_plug_optsR[RER�R+RntsortR%R](R-R�R9t	plugclassRRJRZR[ttmpoptRnR!R"((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRf�sX			-		
$

c	Cs|js#|jjtd��dS|jjtd��|jjd�d�}t|j�}|j�x�|D]�}g}xB|jD]7\}}||�r�||jkr�|j	|�q�q�Wt
d||dt�}x"|D]}|jjd|�q�WqrW|j�dS(Nsno valid profiles founds%The following profiles are available:RcSs
t|d�S(NRn(R�(tc((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt	_has_profss%-15s Rs %s(
RnR�RbR�RR0R+ReR�RR%R�R](	R-RiRntprofileR#RRVR!R"((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRgs"		


cCsd|jjs&|jjtd��dS|jjtd��|jjd�x|jjj�D]�}|sqq_n|jj|�}|jjdd|j	f�|jjdd|j
f�|jr�|jjdd|jf�n|jj
dkrL|jj�}d}t||dtdd
�}x!|D]}|jj|�q/Wn|jjd�q_WdS(Nsno valid presets founds$The following presets are available:Rs%14s %ssname:sdescription:snote:is%14s soptions:RR Rs      options: (R�tpresetsR�RbR�RR0RRR�RRatnoteR�Rrtto_argsR%R�(R-R�R�toptions_strR!R"((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR�.s(	 
RcCs|j}|j|�r0|jjd|�tS|p?|jj}|pQ|jj}y)|jd|d|d|d|j�Wn(t	k
r�}|jjd|�tSX|j
jd�}|j
d|!|j
|d	}|jjd
|dj
|�f�tS(s�Add a new command line preset for the current options with the
            specified name.

            :param name: the name of the new preset
            :returns: True on success or False otherwise
        s"A preset named '%s' already existsRRaRlR�sCould not add preset: %ss--add-presetiis"Added preset '%s' with options %s
R(R�R�RR�RyR�RaRlt
add_presetR:R�tindexR0R�R�(R-RRaRlR�R@t	arg_indexR�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRoFs 	)cCs�|j}|j|�s0|jjd|�tSy|jd|�Wn.tk
rt}|jjt|�d�tSX|jjd|�t	S(s�Delete a named command line preset.

            :param name: the name of the preset to delete
            :returns: True on success or False otherwise
        sPreset '%s' not foundRs
sDeleted preset '%s'
(
R�R�RR�Ryt
del_presetR:RzR0R�(R-RR�R@((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRrcs	cCs�|jjr(|jj|jj��n�|jj�}|td�7}yt|�Wnotk
r�}|jj	d�|j
d�n@tk
r�}|jjd�|jj	|�|j
|�nXdS(Ns,Press ENTER to continue, or CTRL-C to quit.
sExiting on user canceli�R(R�R\RR0R�tget_msgR�RR�R�R�R:(R-R�R@((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR\wscCs�tj�}d}d|}tjj|j|�}|jjd|||f�|jjd|�|jj	d||dd�dS(Ns!caught exception in plugin methods%s-plugin-errors.txts%s "%s.%s()"swriting traceback to %ss%s
tmodeta(
R�t
format_excR2R�R�R�R�R�R�t
add_string(R-RVtmethodttraceR�tplugin_err_logtlogpath((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��s
cCsq|jj�y�|jjtd��d}|jj}||kr�dj|�}|jjd�|jjd|�|jjd	|�|jjd�|j	d
�n|j
�|j�dSWn�tt
fk
r}|jtkrdGHd|jGHdGHq`d|GH�nMtk
r_}|jjd�|jjd
�tj�|jj|�nX|j	d
�dS(Ns Setting up archive ...RNtbzip2tgziptxzs, RsInvalid compression specified: sValid types are: is %s while setting up archivesError setting up archive: %ss) Unexpected exception setting up archive:(sautoR|R}R~(R�tpre_workRR0R�R�RtR�R�R�R�R�tOSErrortIOErrorterrnotfatal_fs_errorststrerrorR:R�t	print_exc(R-tcompression_methodsRxtcompression_listR@((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytprework�s8


	
cCsd}|jj|tddj|j�f�d}|jj|tddj|jj��f�|jjj�}dtd|jj	dj|�f}|jj|�|jjdtddj|jj��f�|j
jtd��x|jD]\}}yP|j
|_
|j�|j�|jj|j�|jjrU|j�nWq�tk
rl�q�ttfk
r�}|jtkr�|j
jd�|j
jd	|j�|j
jd�|jd
�n|j|d�q�tk
r
|j|d�q�Xq�WdS(Ns [%s:%s] executing 'sosreport %s'tsetupRs,[%s:%s] loaded options from config file: %s's'[%s:%s] using '%s' preset defaults (%s)s![%s:%s] effective options now: %ss Setting up plugins ...Rs %s while setting up pluginsi(R�R0R>R�R�R�RmR�R�RRR�R�R�tadd_default_collectionsR�R�R1t	_env_varsRstsetup_verifyR�R�R�R�R�R�R�R�R�R:(R-R�tpreset_argsR�R9R@((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��s@)"#



cCsqg}|jdt�x1|jD]&\}}|jd||jf�q!W|jjddj|�dd�dS(sWFetch version information from all plugins and store in the report
        version files
sosreport: %ss%s: %stcontents
RDsversion.txtN(RR	R�tversionR�RwR�(R-tversionsR�R9((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��scCs6|jjtd��|jjd�d}g|_g|_x5|jD]*}|d7}|jj||df�qHWy�t|jj	�|_
|j
j|jt
|j��}|j
jdt�x+|D]#}|s�|jjd|�q�q�W|jjd�Wn.tk
r1|jjd�tjd�nXdS(Ns! Running plugins. Please wait ...Riitwaits!Unexpected plugin task result: %ss
Exiting on user cancel
(RR0R�tpluglistt
running_plugsR�RRR�Rutplugpooltmapt_collect_pluginR+R�R�R�RaR�R�R2R�(R-tplugruncountR?tresultstres((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytcollect�s*		


c	Cs�td���}yK|j|j|�}|j|dddjpFd}|jd|�Wnftk
r�|jj	d|d�|j
j|d�t|j|ddd_
|jj�nXWdQXtS(saWraps the collect_plugin() method so we can apply a timeout
        against the plugin as a wholeiiR^s
 Plugin %s timed out
N(Rtsubmittcollect_pluginR�R^RMtresultRRR�R�R2R�t_timeout_hitt_threadstclear(R-RVtpoolttR^((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR�s"
c	Cs!y5|\}}|j|dd}|jj|�Wntk
rItSXt|j�}dd||f|ddjd�|jD��f}|j|�y�|j�y|j	j
|�Wntk
r�nXy|jj
|�Wntk
r�nXd}t|j	�t|j
j�krW|jrWddddjd	�|jD��f}n|jrt|j	rtd
}n|r�|j|�nWn�tk
r�nttfk
r�}|jtkr�|jjd|j�|jd�n|j|d�n!tk
r|j|d�nXdS(
Nis  Starting %-5s %-15s %ss%d/%ds
[Running: %s]Rcss|]}|VqdS(N((t.0R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pys	<genexpr>sRs  Finishing plugins %-12s %scss|]}|VqdS(N((R�R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pys	<genexpr>3ss
  Finished running pluginss"
 %s while collecting plugin data
R�(R�R�RR:RyRR�tui_progressR�R�R2RNR{R�RuRR�R�R�R�RR�R�R�R�(	R-RVRqR�R9tnumplugststatus_linetstatusR@((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR�sT

$



!	'	

cCso|jjdkr5|jjr5d|jd�}n
d|}|jjsktjj|�tjj�ndS(Nis
%siZs%s
(	R�RrR\tljustRoR�R�R�R8(R-R�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR�Fs
cCs�|js
dSdjgg|jD]:}tjj|�dk	r |dtjj|�f^q D]\}}d||f^q^�d}|jj|d�dS(Ns
s%ss%s=%stenvironment(R�R�R2tenvirontgetRMR�Rw(R-RR�tenv((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytcollect_env_varsOs	ZcCs�t�}x]|jD]R\}}td|�}x$|jD]}|jt|��q8W|jrw|jt|j��nx9|jD].}|jt	d|ddd|d��q�WxW|j
D]L}|jtd|ddddtj
jd|j�d	|d
���q�WxH|jD]=\}}|jtd|dtj
jdd||���qW|j|�qWtdd
ftddftddff}	x�|	D]�\}
}}y^|j�}
|
|�j�}|
j|�|
j�|jj|
dtj
jd|��Wq�ttfk
r~}|jtkr|jj d�|jj d|j!|f�|jj d�|j"d�qq�Xq�WdS(NRtsrcpaththrefs..tdstpathtcmdtreturn_codeiR�R�tsos_stringsssos.txtttextssos.jsontJSONssos.htmltHTMLRDR�Rs %s while writing %s reporti(#R
R�RtalertstaddRtcustom_textRtcopied_filesRtexecuted_commandsRR2R�R�R�tcopy_stringsRRRRR�tunicodeR�R8R�RR�R�R�R�RR�R�R�(R-treportR�R9tsectiontalertR<R�R�t
formatlisttclass_tfilenamettype_R4toutputR@((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytgenerate_reportsYsT			
	

cCs�x�|jD]�\}}y4|jd�r5|j�n|jjd|�Wq
ttfk
r�}|jtkr�|j	j
d�|j	j
d|j�|j	j
d�|jd�n|j
|d�q
tk
r�|j
|d�q
Xq
WdS(NR_sSkipping postproc for plugin %sRs% %s while post-processing plugin datai(R�t
get_optionR_R�R0R�R�R�R�RR�R�R�R�R:(R-R�R9R@((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR_�s 

cCs�|s
tSyed}t|d�}tj|�}x0trc|j|�}|sSPn|j|�q4W|j�Wntk
r�|j	�nX|j
�S(Niitrbi(RytopenthashlibR7R�treadR1R9R:R�t	hexdigest(R-R�t	hash_namet	hash_sizet
archive_fptdigestthashdata((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_create_checksum�s	
cCs?t|d|d�}|r1|j|d�n|j�dS(NRMtws
(R�R�R9(R-R�R�tchecksumtfp((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_write_checksum�scGCs|j�d}d}|jj�}ddddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGgG}dH}xtj|�D]
\}}}x�|D]�}	|dI|	}
tjj|	�}t|dJ�j	idt
dK�6�}|j�|kr,y&tj
dL|
g�j�dJdM!}
Wntk
r�}dNGHq,nXdOtj
dL|
g�j�dJdM!k}|tkrtj|
|
dP�qq,q,WqW|jjstjdQ�}|jjsYtdR�GHnz�y|jj|jj�}Wn�ttfk
r�}dSGHtdT|j|jj�f�GHdSGH|jtkr|jdJ�qn'tk
r|jj r��qt!SnXWdtj|�Xn}|jj�}tjj"|�}y2tjj#|j$|�}tj||�|}Wn'ttfk
r�tdU|�GHt!SXd}|jjs�|s�dVGHq�|j%j&�}|j'||�}y|j(|||�Wn&ttfk
rtdW|�GHnXtjj#|j$tjj"|��}tj)|�}|dK|}|dK|}ytj||�|}Wn'ttfk
r�tdX|�GHt!SXytj||�Wq�ttfk
r�tdY|�GHq�Xn|jjs|j%j*||||�n|j%j*|||�|jj+s@|jj,r�|jjs�y*|j%j-|�|j.j/tdZ��Wq�tk
r�}|j.j0d[|�q�Xq�d\}|j.j0|�nt1j2�|j3r�|j3j4�n|j5r
tjj6|j5�r
t7|j5�ntS(]Nt386t3grR�tadetasptb64tbastbattbhxtchmtclassR�tcomtcpltcrttdbxtdlltdmgtexetfonthlpthqxthtatinftinstisptjartjstjsetjsptjspxtlnktmdbtmdetmimtmsctmshtmsh1tmsh1xmltmsh2tmsh2xmltmshxmltmsitmsptmsttocxtpcdtpifR�tps1xmltps2tps2xmltpsc1tpsc2tregtscftscrtscttshbtshsturltuutvbtvbetvbstvxdtwstwsctwsftwshtxxesfile --mime-typeR�iRMR�is5Caught exception:: Broken symbolic link file detectedR�s.txti?sCreating compressed archive...Rs %s while finalizing archive %ssError moving directory: %ss Creating archive tarball failed.s#Error writing checksum for file: %ssError moving archive file: %ssError moving checksum file: %ssUploaded archive successfullysUpload attempt failed: %ssEUnable to upload archive when using --build as no archive is created.(8R
RMR�tget_archive_pathR2twalkR�R,R�t	translatetordROt
subprocesstcheck_outputRBRNR�trenameR�R]tumaskRoR�tfinalizeRtR�R�R�R�R�R�R:RaRytbasenameR�R�R�tget_preferred_hash_nameR�R�tstattdisplay_resultstuploadt
upload_urltupload_archiveRR0R�R�R�R�R=R�R�R(R-R�t	directoryttmpdir_patht
MOS_RejecttfilecmdR�tsubdirsR,Rtfullnametfile_extentiontfile_exttmime_outtbrokenR�t	old_umaskR@tdir_namet	final_dirR�R�t
final_nametarchivestattarchive_hasht
final_hashterrR�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
final_work�s�
$*'$'
&&("	




	cCs'|js#|jjtd��tStS(Nsno valid plugins were enabled(R�R�R�R�RyR�(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytverify_pluginsUs	cCsO|jr|jj�n|jr2|jj�n|jrKt|j�ndS(N(R�tcleanupR�R=R�R(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_cleanup[s			cCs2y�|jj|j��|j�|j�|j�|j�|j�|jj	rj|j	�t
�n|jjr�|j�t
�n|jjr�|j�t
�n|jj
r�|j
|jj
�S|jjr�|j|jj�S|j�s�tS|j�|j�|j�|j�|jjs7|j�n|jjsP|j�n|jjsi|j�n|jjd�|j�|j�SWn�tk
r�|jj r��n|j!�ndt"k
r�|jj#d�|j!�|j$d�n-t
k
r }|j!�t%j&|j'�nX|j$d�dS(Ns)Skipping postprocessing of collected datas
Exiting on user canceli�i((R�tset_commonsR�RARGRSRWR\R�RfR�RgR�RoRrR>RyR\R�R�R�RkR�RjR�RlR_RR0R�R=R�RaR@R�R�R�R�texittcode(R-R@((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytexecutees^





	
	
	












N(7R>R?RLR.R�R�R�R�R�R�R�tstaticmethodR�R�R�RMR�R�R
RRRRRRRRARGRSRWR\R]RfRgR�RoRrR\R�R�R�R�R�R�R�R�R�R�R_R�R�R=R>R@RD(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR�sf	g		
							-		
						U		0	
		
	;							"	)	
			3			
	9				�		
cCst|�}|j�dS(sThe main entry pointN(R�RD(R�R�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytmain�s(<RLR�R�R2R�R�RRtargparseRRtsos.pluginsR�t
sos.utilitiesRRtshutilRR0R�tconcurrent.futuresRRR�RR�R	R
Rtsos.policiestsos.archiveRt
sos.reportingR
RRRRRRRRRR�t	six.movesRRtENOSPCtEROFSR�RyR%R)tobjectR*R@R�R�R�RF(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt<module>sHF		������