Viewing File: /usr/lib/python2.7/site-packages/sos/sosreport.pyc


Kjc@sdZddlZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
Zddlm
Z
mZddlmZddlZddlZddlmZmZddlZddlmZdd	lmZdd
lmZmZddlZddlmZddlm 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.ej/fZ0e1ddZ2dZ3de4fdYZ5de	fdYZ6dddgZ7dZ8de4fdYZ9dZ:dS(sm
Gather information about a system and report it using plugins
supplied for application-specific information
iN(tdatetime(tArgumentParsertAction(tImporterHelpertSoSTimeoutError(trmtree(tThreadPoolExecutortTimeoutError(t_sos(t__version__(t
_arg_defaultst
SoSOptions(tTarFileArchive(
tReporttSectiontCommandt
CopiedFiletCreatedFiletAlerttNotetPlainTextReportt
JSONReportt
HTMLReport(tziptinputs, cCsg}|}|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_list3s
&
	
cCstjdj|dS(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_sinceEstTempFileUtilcBs#eZdZdZdZRS(cCs||_g|_dS(N(ttmp_dirtfiles(tselfR+((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt__init__Os	cCsGtjd|j\}}tj|d}|jj||f|S(Ntdirsw+(ttempfiletmkstempR+tostfdopenR,R(R-tfdtfnametfobj((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytnewSscCsxxh|jD]]\}}y|j|jWntk
rAnXytj|Wq
tk
rfq
Xq
Wg|_dS(N(R,tflushtcloset	ExceptionR2tunlink(R-R5tf((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytcleanZs


(t__name__t
__module__R.R7R=(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR*Ms		t
SosListOptioncBseZdZddZRS(s0Allow to specify comma delimited list of pluginscCsdg|jdD]}|^q}t||jrM|t||j7}nt||j|dS(Nt,(tsplittgetattrtdesttsetattr(R-tparsert	namespacetvaluest
option_stringtoptR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt__call__ls"N(R>R?t__doc__tNoneRK(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR@hstautotalwaystneverc
Csd}td|}|jddt|jdddddd	d
tdd|jd
ddddd
tdd|jdddddd
ddtdd|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
ddda|jdbdcddddddtd
gdde|jdfdgddddhd
tddi|jdjdkddddlddmd
d|jdnddddddo|jdpddddqddrd
d|jdsdtdduddvd
tdvddwf|jdxddddyd
tddz|jd{d|dd}d
td}dd~|jddddddddd
ddt	|jdddddd
tdd|jdddd
tdd|jdd
ddd|jdd
ddd|jdd
ddd|jdd
ddd|jdd
d_dd_ddgdd|jdd
d_dd_dddgdd|j
}|jddtdddd|jddtdddd|j
}|jddd|jddd|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--uploads/Upload the archive to a policy-default locations--upload-urls*Upload the archive to the specified servers--upload-directorys.Specify the directory to upload the archive tos
--upload-users.Username to authenticate to upload server withs
--upload-passs.Password to authenticate to upload server withs--upload-methodtchoicestputtposts HTTP method to use for uploadings--upload-protocolthttpstftptsftps$Manually specify the upload protocols--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_parserws









t	SoSReportcBseZdZdZdZdZdZdZdZdZ	dZ
ed	Zd
dZ
dZd6d6d
ZdZdZdZdZdZdZdZddZdZdZdZdZdZdZdZdZ dZ!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/Z0d0Z1d1Z2d2Z3d3Z4d4Z5d5Z6RS(7sThe main sosreport classc	Csg|_g|_g|_t|_d|_d|_||_d|_	d|_
t|_d|_
y)ddl}|j|j|jWntk
rnX|jt}tj|jg|_x,|jD]!}|jdkrd|_qqWtj|j|}|jj|tj||jj|_|jj|j|jy"tj j!d|jj	|_"Wnt#k
r|j$dnX|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
jt/j0j1|j"j2|jj3}t/j0j4|st/j5|t/j6rd|}|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?krd}||_	n|j@jAd|j	|f|jjBtCkr|j@jDd|jjBtEjF|jjG|j$d
ndS(Nt/is==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_tmpRtexit_processRtsignaltSIGTERMtget_exit_handlerR:tprint_headerRRt	from_argst
parse_argstoptst_actionsRVtmerget	from_fileR`tfileoptst
_set_debugtsostpoliciestloadRtKeyboardInterruptt_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-targsRRFtoptiontcmd_optsttmptmsgR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR.s										

	

"
		$

	



cCsdtdtfGHdS(Ns
%s
ssosreport (version %s)(t_R	(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRscCsai	|jd6|jd6|jd6|jd6|jd6|jd6|jd6|jjd6|jd	6S(
NtcmddirtlogdirtrptdirRRRRpRrtcmdlineopts(	RRRRRRRpRRr(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytget_commonss







cCs
|jjS(N(RR7(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
get_temp_filescCs
i|jjs|jjr!tntd6|jjd6|jjd6}tjj|j|j	j
}|jjdkr|j	j}|||j|j	|jj
||j|_n-t||j|j	|jj
||j|_|jj|jjrtntdS(NtencrypttkeytpasswordRN(Rtencrypt_passtencrypt_keyRRR2RtjoinRRtget_archive_nameRttget_preferred_archiveRuRpRRt	set_debugRa(R-tenc_optstarchive_nametauto_archive((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_set_archives 
cCsF|jj|jd|jj|jd|jj|jddS(Ni(RtmakedirsRRR(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_make_archive_pathsscCsd|_d|_d|_dS(Ntsos_commandstsos_logstsos_reports(RRR(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRs		cCs1|jjr$|jt_t|_n	t|_dS(N(RRat
_exceptionRt
excepthookRt
raise_pluginsR(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRsc	Csottdstjjr5tj|||n6tj|||dddtjtj	t
jdS(s* Wrap exception in debugger if not in tty tps1tlimititfileN(thasattrRRtisattyt__excepthook__t	tracebacktprint_exceptiontstdouttsixtprint_tpdbtpm(tetypeteval_tetrace((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRs

icCst|dS(N(t
SystemExit(R-R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRscsfd}|S(Ncst_jdS(N(RRR(tsignumtframe(R-(s1/usr/lib/python2.7/site-packages/sos/sosreport.pytexit_handlers	((R-R((R-s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRscCs|js|jr]tj\}}}tj|||dtjtjt	j
|n|r||r||j||ndS(NR(RRRtexc_infoRRRRRRtpost_mortemt_log_plugin_exception(R-tplugnametfuncRtvalttb((s1/usr/lib/python2.7/site-packages/sos/sosreport.pythandle_exceptions
cCsdtjd|_|jjtj|j|_tj|j}|jtj	d|jtj
|jj||jj
stjtj}|jtj	d|jjr|jjdkr|jtj|jtjnQ|jjr2|jjdkr2|jtj
|jtjn|jtj|jj|tjtj}|jtj	d|jtj|jj|ntjd|_|jjtj
|j|_tj|j}|jtj	d|jj||jj
s`tjtj}|jtj	d|jtj
|jj|ndS(NRs&%(asctime)s %(levelname)s: %(message)ss%(message)siitsos_ui(Rt	getLoggerRtsetLeveltDEBUGRtsos_log_filet
StreamHandlertsetFormattert	FormattertINFOt
addHandlerRRoRRRrtWARNINGRtERRORtui_logtsos_ui_log_file(R-tflogtconsoletconsole_errtui_fhandlert
ui_console((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRsF

cCs~t|ddr=|jj|jdtjjddnt|ddrz|jj|jdtjjddndS(NRRDRssos.logRsui.log(	RCRMRtadd_fileRR2RRR(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
_add_sos_logsscCs|jj}t|jjs"tSt|ds5tS|rU|j|jrUtSt	g|jD]}||jjk^qbS(NRn(
RRmRRnRRRt_is_not_specifiedtnametany(R-tplugin_classRmtp((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_in_profilescCs||jjkS(N(RRi(R-tplugin_name((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_skipped(scCs;||jjo:||jjko:||jjkS(N(Rt
check_enabledRRcRm(R-RtpluginClass((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_inactive+scCs;||jjo:||jjko:||jjkS(N(Rtdefault_enabledRRcRm(R-RR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_not_default0scCs|jjo||jjkS(N(RRm(R-R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR5stunknowncCs/|jj|j||j|fdS(N(RRRR(R-Rtreason((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_skip9s		cCs,|jj|j||jfdS(N(RRRR(R-R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_load@s		cCstjj}ttj}|j}g|_t|_t|j	j}|j
j}g}|j	jr|j
tjjnt||}|j
j}t|j	j}	x|D]}
tjj|
\}}yK|||}
t|
swn|j
j|
}||d|j	jsn|jjtd|
|j	jdkrn|j|tdwqnn|jr|jr|jjtd|
|j|tdwn|jj
||j|}|s|j|tdwn|j|r#|j|tdwn|j ||rQ|j|td	wn|j!||r|j|td
wnt"|dr|jj#|jn|o|}|j$|r|r|j|tdwnx-|jD]"}||	kr|	j%|qqW|j&|Wqt'k
r_}|jjtd
|
|f|j(qXqWt|	dkr|jj)tddj*|	|j+|j,dndS(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(-Rtpluginst
import_pluginRtget_modulestplugin_namesRRnRRRtvalid_subclassesRbRtExperimentalPluginttupletvalidate_plugintlistR2Rtsplitexttmatch_pluginRtwarningRRrR#t
requires_rootRtinfoRRRR RtupdateRtremoveR$R:RRRRgR(R-R*thelperR)tusing_profilestpolicy_classest
extra_classestvalid_plugin_classesR0tremaining_profilestplugtplugbasetexttplugin_classesRt
in_profiletdefault_profiletite((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytload_pluginsFs	
			

cCsv|jjrrxc|jD]U\}}xFt|j|jD]/\}}t|dtkr8t|d<q8q8WqWndS(Ntenabled(	RRURRt	opt_namest	opt_parmsR[tboolR(R-RR?Rtparms((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_set_all_optionss
"cCs|jjri}x|jjD]}y|jd\}}Wntk
rWt}n@X|jdkrst}n$yt|}Wntk
rnXy|jd\}}Wntk
r|}t}nXy||Wntk
rg||<nX||j	||fqWx|j
D]y\}}||krxT||D]H\}}|j||sB|jj
d||f|jdqBqBW||=qqWx(|jD]}|jj
d	|qW|jr|jj
d
qndS(Nt=tofftdisabletdisabledtfalset.s#no such option "%s" for plugin (%s)isFWARNING: unable to set option for disabled or non-existing plugin (%s)R(RORPRQRR(RRdRBt
ValueErrorRtlowerRRtKeyErrorRRt
set_optionRRRtkeys(R-RRJRR?R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
_set_tunablessH

	



cCsddl}xu|j|jj|jj|jjD]L}|jdd}||jkr4|jj	d||j
dq4q4WdS(NiRSis<a non-existing plugin (%s) was specified in the command linei(t	itertoolstchainRRmRiRcRBR,RtfatalR(R-RZtpluginR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_check_for_unknown_pluginss	cCslxe|jD]Z\}}|j\}}x9t||D](\}}|jj||||fq8Wq
WdS(N(Rtget_all_optionsRRR(R-RR]tnamesRLtoptnametoptparm((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_set_plugin_optionss
cCs|jjdt|jrN|jjdt|jt|jfn|jjdt|j|jjddS(NRs %d profiles, %d pluginss %d profiles(RR6RRRn(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_report_profiles_and_pluginss#cCs|jr.|jr.|jjtddS|jr|jjtd|jjdxP|jD],\}}|jjd||jfqgWn|jjtd|jjd|jr2|jjtd|jjdx@|jD]2\}}}|jjd|||jfqWn|jjd|jro|jjtdxE|jd	d	j	D]/}|jjd
|d	|d|dfqvW|jjd|jjtd
x|jD]\}}}}|dkrqnt
|dtkr5|dtkr,d}q?d}n
|d}|jjd
|d|||dfqWn|jjtd|jjdt
|j}	|	jtd|	dt}
x"|
D]}|jjd|qW|jdS(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:ttimeouttpostprocRHtonRORStdescsNo plugin options available.s
Profiles: Rs %s(stimeoutspostproc(RRRR\RRR6tget_descriptionRt_default_plug_optsR[RKRR1RntsortR%Rd(R-RR?t	plugclassR"RJRaRbttmpoptRnR!R"((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRfsX			-		
$

c	Cs|js#|jjtddS|jjtd|jjdd}t|j}|jx|D]}g}xB|jD]7\}}||r||jkr|j	|qqWt
d||dt}x"|D]}|jjd|qWqrW|jdS(Nsno valid profiles founds%The following profiles are available:RcSs
t|dS(NRn(R(tc((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt	_has_prof0ss%-15s Rs %s(
RnRR\RRR6R1RkRRR%RRd(	R-RoRntprofileR)RR]R!R"((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRg)s"		


cCsd|jjs&|jjtddS|jjtd|jjdx|jjjD]}|sqq_n|jj|}|jjdd|j	f|jjdd|j
f|jr|jjdd|jfn|jj
dkrL|jj}d}t||dtdd
}x!|D]}|jj|q/Wn|jjdq_WdS(Nsno valid presets founds$The following presets are available:Rs%14s %ssname:sdescription:snote:is%14s soptions:RR Rs      options: (RtpresetsRR\RRR6RXRRRhtnoteRRrtto_argsR%R(R-RRtoptions_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|jWn(t	k
r}|jjd|tSX|j
jd}|j
d|!|j
|d	}|jjd
|dj
|ftS(sAdd 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 existsRRhRrRsCould not add preset: %ss--add-presetiis"Added preset '%s' with options %s
R(RRRRRRRhRrt
add_presetR:RtindexR6RR(R-RRhRrRRFt	arg_indexR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRuWs 	)cCs|j}|j|s0|jjd|tSy|jd|Wn.tk
rt}|jjt|dtSX|jjd|t	S(sDelete 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'
(
RRRRRt
del_presetR:RR6R(R-RRRF((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRxts	cCs|jjr(|jj|jjn|jj}|td7}yt|Wnotk
r}|jj	d|j
dn@tk
r}|jjd|jj	||j
|nXdS(Ns,Press ENTER to continue, or CTRL-C to quit.
sExiting on user canceliR(RR\RR6Rtget_msgRRRRRR:(R-RRF((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR\scCstj}d}d|}tjj|j|}|jjd|||f|jjd||jj	d||dddS(Ns!caught exception in plugin methods%s-plugin-errors.txts%s "%s.%s()"swriting traceback to %ss%s
tmodeta(
Rt
format_excR2RRRRRRt
add_string(R-R]tmethodttraceRtplugin_err_logtlogpath((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRs
cCsq|jjy|jjtdd}|jj}||krdj|}|jjd|jjd||jjd	||jjd|j	d
n|j
|jdSWntt
fk
r}|jtkrdGHd|jGHdGHq`d|GHnMtk
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:(sautoRRR(Rtpre_workRR6RRRtRRRRRtOSErrortIOErrorterrnotfatal_fs_errorststrerrorR:Rt	print_exc(R-tcompression_methodsR~tcompression_listRF((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytpreworks8


	
cCsd}|jj|tddj|jfd}|jj|tddj|jjf|jjj}dtd|jj	dj|f}|jj||jjdtddj|jjf|j
jtdx|jD]\}}yP|j
|_
|j|j|jj|j|jjrU|jnWqtk
rlqttfk
r}|jtkr|j
jd|j
jd	|j|j
jd|jd
n|j|dqtk
r
|j|dqXqWdS(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(RR6R>RRRRsRRRRRRRtadd_default_collectionsRRR7t	_env_varsRstsetup_verifyRRRRRRRRRR:(R-Rtpreset_argsRR?RF((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRs@)"#



cCsqg}|jdtx1|jD]&\}}|jd||jfq!W|jjddj|dddS(sWFetch version information from all plugins and store in the report
        version files
sosreport: %ss%s: %stcontents
RDsversion.txtN(RR	RtversionRR}R(R-tversionsRR?((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRscCs6|jjtd|jjdd}g|_g|_x5|jD]*}|d7}|jj||dfqHWyt|jj	|_
|j
j|jt
|j}|j
jdtx+|D]#}|s|jjd|qqW|jjdWn.tk
r1|jjdtjdnXdS(Ns! Running plugins. Please wait ...Riitwaits!Unexpected plugin task result: %ss
Exiting on user cancel
(RR6Rtpluglistt
running_plugsRRRRRutplugpooltmapt_collect_pluginR1RRRRaRRR2R(R-tplugruncountREtresultstres((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytcollects*		


c	Cstd}yK|j|j|}|j|dddjpFd}|jd|Wnftk
r|jj	d|d|j
j|dt|j|ddd_
|jjnXWdQXtS(saWraps the collect_plugin() method so we can apply a timeout
        against the plugin as a wholeiiRes
 Plugin %s timed out
N(Rtsubmittcollect_pluginRReRMtresultRRRRR8Rt_timeout_hitt_threadstclear(R-R]tpoolttRe((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRs"
c	Cs!y5|\}}|j|dd}|jj|Wntk
rItSXt|j}dd||f|ddjd|jDf}|j|y|jy|j	j
|Wntk
rnXy|jj
|Wntk
rnXd}t|j	t|j
jkrW|jrWddddjd	|jDf}n|jrt|j	rtd
}n|r|j|nWntk
rnttfk
r}|jtkr|jjd|j|jdn|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((RR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pys	<genexpr>Dss
  Finished running pluginss"
 %s while collecting plugin data
R(RRRR:RRRtui_progressRRR8RTRRRuRRRRRRRRRR(	R-R]RqRR?tnumplugststatus_linetstatusRF((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR$sT

$



!	'	

cCso|jjdkr5|jjr5d|jd}n
d|}|jjsktjj|tjjndS(Nis
%siZs%s
(	RRrR\tljustRoRRRR8(R-R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRWs
cCs|js
dSdjgg|jD]:}tjj|dk	r |dtjj|f^q D]\}}d||f^q^d}|jj|ddS(Ns
s%ss%s=%stenvironment(RRR2tenvirontgetRMRR}(R-RRtenv((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytcollect_env_vars`s	ZcCst}x]|jD]R\}}td|}x$|jD]}|jt|q8W|jrw|jt|jnx9|jD].}|jt	d|ddd|dqWxW|j
D]L}|jtd|ddddtj
jd|jd	|d
qWxH|jD]=\}}|jtd|dtj
jdd||qW|j|qWtdd
ftddftddff}	x|	D]\}
}}y^|j}
|
|j}|
j||
j|jj|
dtj
jd|Wqttfk
r~}|jtkr|jj d|jj d|j!|f|jj d|j"dqqXqWdS(NRtsrcpaththrefs..tdstpathtcmdtreturn_codeiRRtsos_stringsssos.txtttextssos.jsontJSONssos.htmltHTMLRDRRs %s while writing %s reporti(#R
RRtalertstaddRtcustom_textRtcopied_filesRtexecuted_commandsRR2RRRtcopy_stringsRRRRRtunicodeRR8RRRRRRRRRR(R-treportRR?tsectiontalertR<RRt
formatlisttclass_tfilenamettype_R4toutputRF((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytgenerate_reportsjsT			
	

cCsx|jD]\}}y4|jdr5|jn|jjd|Wq
ttfk
r}|jtkr|j	j
d|j	j
d|j|j	j
d|jdn|j
|dq
tk
r|j
|dq
Xq
WdS(NRfsSkipping postproc for plugin %sRs% %s while post-processing plugin datai(Rt
get_optionRfRR6RRRRRRRRRR:(R-RR?RF((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRfs 

cCs|s
tSyed}t|d}tj|}x0trc|j|}|sSPn|j|q4W|jWntk
r|j	nX|j
S(Niitrbi(RtopenthashlibR7RtreadR7R9R:Rt	hexdigest(R-Rt	hash_namet	hash_sizet
archive_fptdigestthashdata((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_create_checksums	
cCs?t|d|d}|r1|j|dn|jdS(NRStws
(RRR9(R-RRtchecksumtfp((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_write_checksumscCs|jd}d}|jjstjd}|jjsKtdGHnzy|jj	|jj
}Wnttfk
r}dGHtd|j
|jjfGHdGH|jtkr|jdqn'tk
r|jjrqtSnXWdtj|Xn}|jj}tjj|}y2tjj|j|}tj|||}Wn'ttfk
rtd|GHtSXd}|jjs|sdGHq|jj}|j||}y|j|||Wn&ttfk
rtd|GHnXtjj|jtjj|}	tj|}
|d	|}|	d	|}ytj||	|	}Wn'ttfk
rtd
|GHtSXytj||Wqttfk
rtd|GHqXn|jjs|jj||||
n|jj||||jj s2|jj!r|jjsy*|jj"||j#j$tdWqtk
r}
|j#j%d
|
qXqd}|j#j%|nt&j'|j(r|j(j)n|j*rtjj+|j*rt,|j*nt-S(Ni?sCreating compressed archive...Rs %s while finalizing archive %sisError moving directory: %ss Creating archive tarball failed.s#Error writing checksum for file: %sRSsError moving archive file: %ssError moving checksum file: %ssUploaded archive successfullysUpload attempt failed: %ssEUnable to upload archive when using --build as no archive is created.(.RRMRR]R2tumaskRoRRtfinalizeRtRRRtget_archive_pathRRRR:RaRRtbasenameRRtrenameRtget_preferred_hash_nameRRtstattdisplay_resultstuploadt
upload_urltupload_archiveRR6RRRRR=RRRR(R-Rt	directoryt	old_umaskRFtdir_namet	final_dirRRt
final_nametarchivestattarchive_hasht
final_hashterrR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
final_works
	




	cCs'|js#|jjtdtStS(Nsno valid plugins were enabled(RRRRRR(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytverify_pluginsJs	cCsO|jr|jjn|jr2|jjn|jrKt|jndS(N(RtcleanupRR=RR(R-((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_cleanupPs			cCs2y|jj|j|j|j|j|j|j|jj	rj|j	t
n|jjr|jt
n|jjr|jt
n|jj
r|j
|jj
S|jjr|j|jjS|jstS|j|j|j|j|jjs7|jn|jjsP|jn|jjsi|jn|jjd|j|jSWntk
r|jj rn|j!ndt"k
r|jj#d|j!|j$dn-t
k
r }|j!t%j&|j'nX|j$ddS(Ns)Skipping postprocessing of collected datas
Exiting on user cancelii((Rtset_commonsRRGRMRYR^RcRRfRRgRRuRxRRR\RRRRkRRjRRlRfRR6RRRRaRRRRRtexittcode(R-RF((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytexecuteZs^





	
	
	












N(7R>R?RLR.RRRRRRRtstaticmethodRRRRMRRRRRRR RR#R$RGRMRYR^RcRdRfRgRRuRxR\RRRRRRRRRRRfRRRRRR(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRsf	g		
							-		
						U		0			
	;							"	)	
			3			
	9				{		
cCst|}|jdS(sThe main entry pointN(RR(RR((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytmains(;RLRRR2RRRtargparseRRtsos.pluginsRt
sos.utilitiesRRtshutilRR0Rtconcurrent.futuresRRRRRR	R
Rtsos.policiestsos.archiveRt
sos.reportingR
RRRRRRRRRRt	six.movesRRtENOSPCtEROFSRRR%R)tobjectR*R@RRRR(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt<module>sFF		{
Back to Directory File Manager