????

Your IP : 216.73.216.152


Current Path : /proc/self/root/lib/python2.7/site-packages/sos/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/sos/sosreport.pyc

�
Dr^c@s�dZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
ddlmZm
Z
ddlmZddlZddlZddlmZmZddlZddlmZdd	lmZdd
lmZmZddlZddlmZddlm 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-fZ.e/dd�Z0de1fd��YZ2defd��YZ3dddgZ4d�Z5de1fd��YZ6d�Z7dS(sm
Gather information about a system and report it using plugins
supplied for application-specific information
i����N(tArgumentParsertAction(t
import_plugin(tImporterHelpertSoSTimeoutError(trmtree(tThreadPoolExecutortTimeoutError(t_sos(t__version__(t
_arg_defaultst
SoSOptions(tTarFileArchive(tReporttSectiontCommandt
CopiedFiletCreatedFiletAlerttNotetPlainTextReport(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_list1s
&
	
tTempFileUtilcBs#eZd�Zd�Zd�ZRS(cCs||_g|_dS(N(ttmp_dirtfiles(tselfR%((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt__init__Es	cCsGtjd|j�\}}tj|d�}|jj||f�|S(Ntdirsw+(ttempfiletmkstempR%tostfdopenR&R(R'tfdtfnametfobj((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytnewIscCsxxh|jD]]\}}y|j�|j�Wntk
rAnXytj|�Wq
tk
rfq
Xq
Wg|_dS(N(R&tflushtcloset	ExceptionR,tunlink(R'R/tf((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytcleanPs


(t__name__t
__module__R(R1R7(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR$Cs		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__bs"N(R8R9t__doc__tNoneRE(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR:^stautotalwaystneverc
Cs�d}td|�}|jddt�|jdddddd	d
tdd�|jd
ddddd
tdd�|jdddddd
tdd�|jdddddd
tdd�|jddddddd�|jddddddddd
td�|jddtdddd d
d!dd"�|jd#dddd$dd%�|jd&d'dtdddd(d
d)�|jd*dddd+�|jd,dddd-d
tdd.�|jd/d0dddd1dtdd2d
g�|jd3d4dddd5dtdd6d
g�|jd7d8dddd9dd:�|jd;d<dddd=d
tdd>�|jd?dddd@�|jdAddddBd
tddC�|jdDddddEdtd
tdEddF�|jdGdHddddIdtddJd
g�|jdKddddLddMd
t�|jdNdtddd
d)ddO�|jdPdQddddRdtddSd
g�|jdTdddtddUd
dV�|jdWd
d�ddX�|jdYdZdddd[dtd
gdd\�|jd]d^dddd_d
tdd`�|jdadbddddcdddd
d��|jdeddddddf�|jdgddddhddid
d��|jdjdkddlddmd
tdmddn�f|jdoddddpd
tddq�|jdrdsddtd
tdtddu�|jdvdwddddxddyd
dzdt�|j	�}|jd{dtdddd|�|jd}dtdddd~�|j	�}|jddd��|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_trueR>t
alloptionstdefaultthelps%enable all options for loaded pluginss
--all-logstall_logss-collect all available logs regardless of sizes--batchtbatchs(batch mode - do not prompt interactivelys--buildtbuilds;preserve the temporary directory and do not package resultss	--case-idtstoretcase_idsspecify case identifiers-cs--chroottchrootsHchroot executed commands to SYSROOT [auto, always, never] (default=auto)s
--config-filettypetconfig_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--notesBehaviour notes for new presets-os--only-pluginstonlypluginssenable these plugins onlys--presetsA preset identifierRHs--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--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_argumenttFalseR
tstrtintRGtadd_mutually_exclusive_group(tusage_stringR@t
preset_grptencrypt_grp((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_get_parserms�









t	SoSReportcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
ed	��Zd
d�Z
d�Zd7d7d
�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�Z6d6�Z7RS(8sThe main sosreport classc	Cs�g|_g|_g|_d|_d|_||_d|_d|_t	|_
d|_y)ddl}|j|j
|j��Wntk
r�nXt�}t�j|jg��|_x,|jD]!}|jdkr�d|_q�q�Wt�j|j|��}|jj|�t�j||jj�|_|jj|j�|j�y"tjjd|jj�|_Wnt k
r�|j!d�nX|jj"�|_#|jjt$dkr |jj%|jj�|_|js t&j'j(d|jj�|jj)�|_t*|j_+q n|js>|jj)�|_n|jj|jj�t,j-j.|jj/|jj0��}t,j-j1|�s�t,j2|t,j3�r�d|}|d	7}t&j'j(|�|j!d
�n||_t4j5ddd
|j�|_6t7|j6�|_|j8�|j9�d}|jj:�}|jjr[d}|jj|_n0|jj;�r�|t,j<kr�d}||_n|j=j>d|j|f�|jj?t@kr�|j=jAd|jj?�tBjC�|jjD�|j!d
�ndS(Nt/i����s==SUPPRESS==RgitpresetsUnknown preset: '%s'
stemporary directory %s s"does not exist or is not writable
itprefixssos.R)RPtcmdlinetpolicysset sysroot to '%s' (%s)sinvalid chroot mode: %s(Etloaded_pluginstskipped_pluginstall_optionsRGtarchivet
tempfile_utilt_argsRgtsys_tmpRotexit_processRytsignaltSIGTERMtget_exit_handlerR4RvRt	from_argst
parse_argstoptst_actionsRPtmerget	from_fileRYtfileoptst
_set_debugtsostpoliciestloadR|tKeyboardInterruptt_exittis_roott_is_rootR
tfind_presettsyststderrtwritetprobe_presettTruetlist_presetsR,tpathtabspathtget_tmp_dirR%tisdirtaccesstW_OKR*tmkdtempttmpdirR$t_set_directoriest_setup_loggingthost_sysroottin_containerRtsoslogRZRWtchroot_modesterrortloggingtshutdownR7(	R'targsR�R@toptiontcmd_optsttmptmsgR�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR(�s�										
	

"
		$

	



cCs%|jjdtdtf��dS(Ns
%s
ssosreport (version %s)(tui_logtinfot_R	(R'((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytprint_headerWscCsai	|jd6|jd6|jd6|jd6|jd6|jd6|jd6|jjd6|jd	6S(
NtcmddirtlogdirtrptdirR�R�R|RgRitcmdlineopts(	R�R�R�R�R�R|RgR�Ri(R'((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytget_commons[s







cCs
|jj�S(N(R�R1(R'((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
get_temp_filehscCs
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(NtencrypttkeytpasswordRH(R�tencrypt_passtencrypt_keyR�RoR,R�tjoinR�R|tget_archive_nameRktget_preferred_archiveRlRgR�Rt	set_debugRZ(R'tenc_optstarchive_nametauto_archive((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_set_archiveks 
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�RZt
_exceptionR�t
excepthookR�t
raise_pluginsRo(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
cCstjd�|_|jjtj�|j�|_tj|j�}|jtj	d��|jtj
�|jj|�|jj
sUtjtj�}|jtj	d��|jjr�|jjdkr�|jtj�|jtj�nQ|jjr2|jjdkr2|jtj
�|jtj�n|jtj�|jj|�ntjd�|_|jjtj
�|j�|_tj|j�}|jtj	d��|jj|�|jj
stjtj�}|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�RfR�R�RitWARNINGR�tsos_ui_log_fileR�(R'tflogtconsoletui_fhandlert
ui_console((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��s>

cCs~t|dd�r=|jj|jdtjjdd��nt|dd�rz|jj|jdtjjdd��ndS(NR�R>R�ssos.logR�sui.log(	R=RGR�tadd_fileR�R,R�R�R�(R'((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
_add_sos_logs�scCs�|jj}t|jj�s"tSt|d�s5tS|rU|j|j��rUtSt	g|jD]}||jjk^qb�S(NRe(
R�RdRReR�R�Rot_is_not_specifiedtnametany(R'tplugin_classRdtp((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_in_profile�scCs||jjkS(N(R�Rb(R'tplugin_name((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_skipped�scCs;||j��j�o:||jjko:||jjkS(N(R�t
check_enabledR�R\Rd(R'RtpluginClass((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_inactive�scCs;||j��j�o:||jjko:||jjkS(N(R�tdefault_enabledR�R\Rd(R'RR
((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_is_not_default�scCs|jjo||jjkS(N(R�Rd(R'R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRstunknowncCs/|jj|j�||j��|f�dS(N(R~RRR�(R'Rtreason((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_skips		cCs,|jj|j�||j��f�dS(N(R}RRR�(R'R((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_load
s		cCs�ddl}t|j�}|j�}g|_t�|_t|jj�}|j	j
}g}|jjr�|j|jj
�nt||�}|j	j}t|jj�}	x�|D]�}
tjj|
�\}}yKt||�}
t|
�s�w�n|j	j|
�}||d|jj�sn|jjtd�|
�|jjdkrn|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(Ni����R[s%plugin %s does not validate, skippingisdoes not validates7plugin %s requires root permissionsto execute, skippings
requires roottexcludedtskippedtinactivetoptionalRes
not specifieds(plugin %s does not install, skipping: %ss+Unknown or inactive profile(s) provided: %ss, i(-tsos.pluginsRtpluginstget_modulestplugin_namestsetReRR�R|tvalid_subclassesR[RtExperimentalPluginttupletvalidate_plugintlistR,R�tsplitextRtmatch_pluginR�twarningR�RiRt
requires_rootR�R�RRRR
R�tupdateRtremoveRR4R�R�R�R`R�(R'R�thelperRtusing_profilestpolicy_classest
extra_classestvalid_plugin_classesRtremaining_profilestplugtplugbasetexttplugin_classesRt
in_profiletdefault_profiletite((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytload_pluginss�	
			

cCsv|jjrrxc|jD]U\}}xFt|j|j�D]/\}}t|d�tkr8t|d<q8q8WqWndS(Ntenabled(	R�ROR}Rt	opt_namest	opt_parmsRXtboolR�(R'R�R,Rtparms((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_set_all_optionsis
"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(R<R=R>R?(R�R]R<t
ValueErrorR�tlowerRoRqtKeyErrorRR}t
set_optionR�R�R�tkeys(R'R�RDR�R,R�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt
_set_tunablespsH

	



cCs�ddl}xu|j|jj|jj|jj�D]L}|jd�d}||jkr4|jj	d|�|j
d�q4q4WdS(Ni����R@is<a non-existing plugin (%s) was specified in the command linei(t	itertoolstchainR�RdRbR\R<RR�tfatalR�(R'RGtpluginR((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_optionsRRR(R'RRJtnamesR9toptnametoptparm((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(R�R�RR}Re(R'((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_report_profiles_and_plugins�s#cCs�|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�|jr|jjtd��|jjtd	��x�|jD]�\}}}}|d
kr�q�nt	|d�t
kr�|dtkr�d}q�d
}n
|d}|jjd|d|||df�q�Wn|jjtd��|jjd�t|j
�}|j�td|dt�}	x"|	D]}
|jjd|
�qrW|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 %ss+The following plugin options are available:sk
 Option 'timeout' available to all plugins - time in seconds to allow plugin to run, use 0 for no timeout
ttimeoutR5tonR<s %-25s %-15s %sR@tdescsNo plugin options available.s
Profiles: Rs %s(R}R~R�RIR�R�R�tget_descriptionRRXR8R�RRetsortR#RQ(R'R�R,t	plugclassRRNROttmpoptReRR ((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR_�sR					
$

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(NRe(R�(tc((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt	_has_prof�ss%-15s Rs %s(
ReR�RIR�R�R�RRVR}RR#R�RQ(	R'RZRetprofileRRRJRR ((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR`�s"		


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:RRRs      options: (R|tpresetsR�RIR�R�R�RER�RRTtnoteR�Ritto_argsR#R�(R'RyR�toptions_strRR ((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 existsRRTR]R�sCould not add preset: %ss--add-presetiis"Added preset '%s' with options %s
R(R|R�R�R�RoR�RTR]t
add_presetR4R�tindexR�R�R�(R'RRTR]R|R3t	arg_indexR�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR`"s 	)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�R�R�Rot
del_presetR4RpR�R�(R'RR|R3((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRc?s	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�RSR�R�R|tget_msgR�RR�R�R�R4(R'R�R3((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRSSs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_excR,R�R�R�R�R�R�t
add_string(R'RJtmethodttraceR�tplugin_err_logtlogpath((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR�cs
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 ...RHtbzip2tgziptxzs, RsInvalid compression specified: sValid types are: is %s while setting up archivesError setting up archive: %ss) Unexpected exception setting up archive:(sautoRmRnRo(R|tpre_workR�R�R�R�RkR�R�R�R�R�tOSErrortIOErrorterrnotfatal_fs_errorststrerrorR4R�t	print_exc(R'tcompression_methodsRitcompression_listR3((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytpreworkls8


	
cCs�d}|jj|tddj|j�f�d}|jj|tddj|jj��f�|jjj�}dtd|jj	dj|�f}|jj|�|jjdtddj|jj��f�|j
jtd��x�|jD]�\}}y3|j
|_
|j�|jjr8|j�nWq�tk
rO�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�R�R8R�R�R�R^RyR�RR�R�R}R�RzRjtsetup_verifyR�RqRrRsRtR�RuR�R�R4(R'R�tpreset_argsR�R,R3((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRz�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
R>sversion.txtN(RR	R}tversionR�RhR�(R'tversionsR�R,((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
(R�R�R�tpluglistt
running_plugsR}RRR�Rltplugpooltmapt_collect_pluginRR�R�R�RZR�R�R,R�(R'tplugruncountR2tresultstres((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 wholeiiRRs
 Plugin %s timed out
N(Rtsubmittcollect_pluginR}RRRGtresultRR�R�R�R%R�t_timeout_hitt_threadstclear(R'RJtpoolttRR((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>
ss
  Finished running pluginss"
 %s while collecting plugin data
R�(R}R�RR4RoRR�tui_progressR�R�R%RARqR�RlRRqRrRsRtR�R�RuR�R�(	R'RJRhR�R,tnumplugststatus_linetstatusR3((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�RiRStljustRfR�R�R�R2(R'R�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR� s
cCs
t�}x*|jD]\}}td|�}x$|jD]}|jt|��q8W|jrw|jt|j��nx9|jD].}|jt	d|ddd|d��q�Wx?|j
D]4}|jtd|ddddd	|d
��q�Wx-|jD]"\}}|jt
d|��q�W|j|�qWy^|j�}	t|�j�}
|	j|
�|	j�|jj|	dtjjdd
��Wnottfk
r}|jtkr|jjd�|jjd|j�|jjd�|jd�qnXdS(NRtsrcpaththrefs..tdstpathtexetreturn_codeis../R�R>R�ssos.txtRs %s while writing text reporti( R
R}RtalertstaddRtcustom_textRtcopied_filesRtexecuted_commandsRtcopy_stringsRR�RtunicodeR�R2R�R�R,R�R�RqRrRsRtR�R�RuR�(R'treportR�R,tsectiontalertR6tcmdR}R.toutputR3((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytplain_report)s<		

cCs�y|j�Wnottfk
r}|jtkr�|jjd�|jjd|j�|jjd�|jd�q�nXdS(NRs %s while writing HTML reporti(	t_html_reportRqRrRsRtR�R�RuR�(R'R3((s1/usr/lib/python2.7/site-packages/sos/sosreport.pythtml_reportPsc
Cs|j�}|jd�g}g}xR|jD]G\}}x+|jD] }|jd|||f�qEW|j|�q/W|jd�|jd�d}xhtt|��D]T}|jd||||f�t|d�d}|d	kr�|jd
�q�q�W|d	ks!|jd
�n|jd�|jd�|jd
�x|D]}|jd|�qOW|jd�xR|jD]G\}}y|j�}	Wnt	k
r�|j
�q�X|j|	�q�W|jd�|j�|jj
|dtjjdd��dS(Ns�
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
        <head>
            <link rel="stylesheet" type="text/css" media="screen"
                  href="donot.css" />
            <meta http-equiv="Content-Type" content="text/html;
                  charset=utf-8" />
            <title>Sos System Report</title>
        </head>
        <body>
        s<a href="#%s">%s</a>: %ss<hr/><h3>Loaded Plugins:</h3>s<table><tr>
is<td><a href="#%s">%s</a></td>
iiis</tr>s	</table>
s<hr/><h3>Alerts:</h3>s<ul>s<li>%s</li>s</ul>s</body></html>R>R�ssos.html(R�R�R}R�RtrangeRtdivmodR�R4R�R2R�R�R,R�R�(
R'trfdt	allAlertst	plugNamesR�R,R�trrR2thtml((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR�[sL









cCs�x�|jD]�\}}y|j�Wq
ttfk
r�}|jtkr�|jjd�|jjd|j�|jjd�|j	d�n|j
|d�q
tk
r�|j
|d�q
Xq
WdS(NRs% %s while post-processing plugin dataitpostproc(R}R�RqRrRsRtR�R�RuR�R�R4(R'R�R,R3((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyR��s
cCsO|s
tSt|d�}tj|�}|j|j��|j�|j�S(Ntrb(RotopenthashlibR1R$treadR3t	hexdigest(R'R�t	hash_namet
archive_fptdigest((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_create_checksum�s
cCs?t|d|d�}|r1|j|d�n|j�dS(NR@tws
(R�R�R3(R'R�R�tchecksumtfp((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_write_checksum�scCs8|j�d}d}|jjstjd�}|jjsKtd�GHnz�y|jj	|jj
�}Wn�ttfk
r�}dGHtd|j
|jj�f�GHdGH|jtkr�|jd�q�n'tk
r�|jjr��q�tSnXWdtj|�Xn}|jj�}tjj|�}y2tjj|j|�}tj||�|}Wn'ttfk
r�td|�GHtSXd}|jjs�|s�dGHq�|jj�}|j||�}y|j|||�Wn&ttfk
rtd|�GHnXtjj|jtjj|��}	|d	|}
|	d	|}ytj||	�|	}Wn'ttfk
r�td
|�GHtSXytj|
|�Wq�ttfk
r�td|
�GHq�Xn|jj|||�tj �|j!r|j!j"�n|j#r4tjj$|j#�r4t%|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: %sR@sError moving archive file: %ssError moving checksum file: %s('RRGR�RTR,tumaskRfR�R�tfinalizeRkRqRrRutget_archive_pathRsRtR�R4RZRoR�tbasenameR�R�trenameR|tget_preferred_hash_nameR�R�tdisplay_resultsR�R�R�R7R�R�RR�(R'R�t	directoryt	old_umaskR3tdir_namet	final_dirR�R�t
final_nametarchive_hasht
final_hash((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�RoR�(R'((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytverify_plugins s	cCsO|jr|jj�n|jr2|jj�n|jrKt|j�ndS(N(R�tcleanupR�R7R�R(R'((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt_cleanup&s			cCs	yj|jj|j��|j�|j�|j�|j�|j�|j�|j	j
rt|j
�t�n|j	jr�|j�t�n|j	j
r�|j
�t�n|j	jr�|j|j	j�S|j	jr�|j|j	j�S|j�stS|j�|j�|j�|j�|j	jsK|j�|j�n|j�|j�|j�SWn�tk
r�|j	jr��n|j�n_tk
r�|j j!d�|j�|j"d�n(tk
r�|j�|j"d�nX|j"d�dS(Ns
Exiting on user canceli�ii(#R|tset_commonsR�R�R4R:RFRKRPR�R_R�R`R�R`RcR�RoRSRyRzR�RcR�R�R�R~R�RqRZR�R�R�R�R�(R'((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytexecute0sZ






	
	
	













N(8R8R9RFR(R�R�R�R�R�R�R�tstaticmethodR�R�R�RGR�R�RRRRR
RRRR4R:RFRKRPRQR_R`R�R`RcRSR�RyRzR~R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyRw�sh	c		
							(		
						V		0			
	8							"	'	
			3			'		<		
		i		
cCst|�}|j�dS(sThe main entry pointN(RwR�(R�R�((s1/usr/lib/python2.7/site-packages/sos/sosreport.pytmaines(8RFR�R�R,RsR�targparseRRRRt
sos.utilitiesRRtshutilRR*R�tconcurrent.futuresRRR�R�RR�R	R
Rtsos.policiestsos.archiveRt
sos.reportingR
RRRRRRRR�t	six.movesRRtENOSPCtEROFSRtRoR#tobjectR$R:R�RvRwR�(((s1/usr/lib/python2.7/site-packages/sos/sosreport.pyt<module>sB:	�����y