Your IP : 172.28.240.42


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

ó
ÍÿŠTc@sšddlZddlZddlmZmZddlmZddlmZddl	m
Z
ddlmZm
Z
deefd„ƒYZd	„ZdS(
iÿÿÿÿN(tApplicationtService(tstartApplication(trotate_logs(tLandscapeReactor(tget_versioned_persisttinit_loggingtLandscapeServicecBs5eZdZeZdZd„Zd„Zd„Z	RS(sUtility superclass for defining Landscape services.

    This sets up the reactor and L{Persist} object.

    @cvar service_name: The lower-case name of the service. This is used to
        generate the bpickle and the Unix socket filenames.
    @ivar config: A L{Configuration} object.
    @ivar reactor: A L{LandscapeReactor} object.
    @ivar persist: A L{Persist} object, if C{persist_filename} is defined.
    @ivar factory: A L{LandscapeComponentProtocolFactory}, it must be provided
        by instances of sub-classes.
    cs³||_yddlm}Wntk
r0nX|jƒ|jƒ|_|jret|ƒ|_	n|jdk	o}|jjs¯ddlm‰t
j
t
j‡fd†ƒndS(Niÿÿÿÿ(tbpickle_dbus(treactorcs
ˆjtƒS(N(tcallFromThreadR(tsignaltframe(R	(s5/usr/lib/python2.7/dist-packages/landscape/service.pyt<lambda>+s(tconfigt
landscape.libRtImportErrortinstalltreactor_factoryR	tpersist_filenameRtpersisttNonetignore_sigusr1ttwisted.internetRtSIGUSR1(tselfRR((R	s5/usr/lib/python2.7/dist-packages/landscape/service.pyt__init__s	

	cCs:tj|ƒtjd|jjƒ|jjƒfƒdS(Ns%s started with config %s(RtstartServicetloggingtinfotservice_namet
capitalizeRtget_config_filename(R((s5/usr/lib/python2.7/dist-packages/landscape/service.pyR-s
	cCs:tj|ƒtjd|jjƒ|jjƒfƒdS(Ns%s stopped with config %s(RtstopServiceRRRRRR (R((s5/usr/lib/python2.7/dist-packages/landscape/service.pyR!2s
	N(
t__name__t
__module__t__doc__RRRRRRR!(((s5/usr/lib/python2.7/dist-packages/landscape/service.pyRs		cs~|ƒ‰ˆj|ƒtˆ|jƒtd|jfƒ‰|ˆƒ‰ˆjˆƒˆjdkr>ddlm}d|_g‰x„t	ˆjƒD]s}ˆj
ƒ}|jd|7_ˆj|_
|jd|7_|jd|7_t|_ˆj||ƒƒq“Wtˆ_‡‡‡‡fd†}ˆjj|ƒntˆtƒˆjrmtjtjtjƒnˆjjƒd	S(
s}Run a Landscape service.

    This function instantiates the specified L{LandscapeService} subclass and
    attaches the resulting service object to a Twisted C{Application}.  After
    that it starts the Twisted L{Application} and calls the
    L{LandscapeReactor.run} method of the L{LandscapeService}'s reactor.

    @param configuration_class: The service-specific subclass of
        L{Configuration} used to parse C{args} and build the C{service_class}
        object.
    @param service_class: The L{LandscapeService} subclass to create and start.
    @param args: Command line arguments used to initialize the configuration.
    slandscape-%siiÿÿÿÿ(tMethodCallSenderi,s	 Clone %ds	-clone-%dcsmtˆjƒ}|ˆj}xJtˆƒD]<\}}‡fd†}ˆjj||d|d|ƒq)WdS(Ncs!|jˆƒ|jjdƒdS(Ntrun(tsetServiceParentR	tfire(tclone(tapplication(s5/usr/lib/python2.7/dist-packages/landscape/service.pytstartqs
iR)(tfloattstart_clones_overtclonest	enumerateR	t
call_later(R-tdelaytiR)R+(R*tserviceR.t
configuration(s5/usr/lib/python2.7/dist-packages/landscape/service.pytstart_clonesjs

N(tloadRRRR'R.tlandscape.lib.ampR%ttimeouttrangeR)tcomputer_titlet	data_pathtmaster_data_pathtlog_dirtTruetis_clonetappendtFalseR	tcall_when_runningRt
ignore_sigintRtSIGINTtSIG_IGNR&(tconfiguration_classt
service_classtargsR%R2tclone_configR5((R3R*R.R4s5/usr/lib/python2.7/dist-packages/landscape/service.pytrun_landscape_service:s2	

			

	(RRttwisted.application.serviceRRttwisted.application.appRt
landscape.logRtlandscape.reactorRtlandscape.deploymentRRtobjectRRJ(((s5/usr/lib/python2.7/dist-packages/landscape/service.pyt<module>s.