Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/landscape/sysinfo/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pyc

ó
ÍÿŠTc@sïdZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZmZddl
mZddlmZmZd	d
ddd
dddgZdefd„ƒYZdd„Zdd„Zddd„ZdS(s%Deployment code for the sysinfo tool.iÿÿÿÿN(t	getLoggert	Formatter(tRotatingFileHandler(t
namedClass(tDeferredt
maybeDeferred(tBaseConfiguration(tSysInfoPluginRegistrytformat_sysinfotLoadtDisktMemorytTemperaturet	Processest
LoggedInUserst
LandscapeLinktNetworktSysInfoConfigurationcBsceZdZdZejƒdkr@eejjdƒf7ZndZd„Z	d„Z
d„ZRS(	s9Specialized configuration for the Landscape sysinfo tool.s/etc/landscape/client.confis~/.landscape/sysinfo.conftsysinfocCsatt|ƒjƒ}|jdddddƒ|jdddddƒdd	jtƒ|_|S(
sg
        Specialize L{Configuration.make_parser}, adding any
        sysinfo-specific options.
        s--sysinfo-pluginstmetavartPLUGIN_LISTthelpsNComma-delimited list of sysinfo plugins to use. Default is to use all plugins.s--exclude-sysinfo-pluginsshComma-delimited list of sysinfo plugins to NOT use. This always take precedence over plugins to include.sDefault plugins: %ss, (tsuperRtmake_parsert
add_optiontjointALL_PLUGINStepilog(tselftparser((s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pyRscCs&g|jdƒD]}|jƒ^qS(Nt,(tsplittstrip(Rtplugin_spectx((s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pytget_plugin_names/scCs©|jdkrt}n|j|jƒ}|jdkrBg}n|j|jƒ}g|D]}||kr[|^q[}g|D]%}td|jƒ|fƒƒ^q€S(Nslandscape.sysinfo.%s.%s(tsysinfo_pluginstNoneRR#texclude_sysinfo_pluginsRtlower(RtincludetexcludeR"tpluginstplugin_name((s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pytget_plugins2s		%(s/etc/landscape/client.conf(t__name__t
__module__t__doc__tdefault_config_filenamestostgetuidtpatht
expandusertconfig_sectionRR#R,(((s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pyRs		cCs@|dkr<tjƒdkr'd}q<tjjdƒ}n|S(ss
    Work out the correct path to store logs in depending on the effective
    user id of the current process.
    is/var/log/landscapes~/.landscapeN(R%R1R2R3R4(t
landscape_dir((s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pytget_landscape_log_directoryAs
	cCs”t|ƒ}tdƒ}t|_tjj|ƒsCtj|ƒntjj|dƒ}t	|dd	ddƒ}|j
|ƒ|jtdƒƒdS(
Nslandscape-sysinfossysinfo.logtmaxBytesiôitbackupCountis'%(asctime)s %(levelname)-8s %(message)siÐ(
R7RtFalset	propagateR1R3tisdirtmkdirRRt
addHandlertsetFormatterR(R6tloggertlog_filenamethandler((s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pyt
setup_loggingNs		
csytƒWn$tk
r1}tjd|ƒnXˆdkrJtƒ‰ntƒ}|j|dtƒx!|j	ƒD]}ˆj
|ƒqsW‡fd†‰‡‡fd†‰ˆdk	rtƒ‰ˆj‡‡fd†ƒ‡fd†}ˆj
|ƒˆjƒn	ˆƒ‰ˆS(sQ
    @param reactor: The reactor to (optionally) run the sysinfo plugins in.
    sUnable to setup logging. %st!accept_nonexistent_default_configcs-tˆjƒˆjƒˆjƒddƒGHdS(Ntindents  (Rtget_headerst	get_notest
get_footnotes(tresult(R(s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pytshow_outputmscsˆjƒjˆƒS(N(truntaddCallback((RJR(s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pytrun_sysinfoqscstˆƒjˆƒS(N(Rt
chainDeferred((tdoneRM(s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pyt<lambda>zscsˆjdˆjƒ|S(Ni(t	callLatertstop(RI(treactor(s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pytstop_reactor|sN(RCtIOErrortsystexitR%RRtloadtTrueR,taddRtcallWhenRunningtaddBothRK(targsRSRtetconfigtpluginRT((RSRMRORJRs@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pyRK[s*		

	(R/R1RVtloggingRRtlogging.handlersRttwisted.python.reflectRttwisted.internet.deferRRtlandscape.deploymentRtlandscape.sysinfo.sysinfoRRRRR%R7RCRK(((s@/usr/lib/python2.7/dist-packages/landscape/sysinfo/deployment.pyt<module>s/