403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/landscape/manager/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyc
ó
}9Rc@sÀddlZddlZddlmZddlmZmZddlmZddl	m
Z
ddlmZm
Z
mZdefd„ƒYZd	efd
„ƒYZdefd„ƒYZdS(
iÿÿÿÿN(tFailure(tgetProcessValuetgetProcessOutputAndValue(tsucceed(tlog_failure(t
ManagerPlugint	SUCCEEDEDtFAILEDtCharmScriptErrorcBs eZdZd„Zd„ZRS(s²
    Raised when a charm-provided script fails with a non-zero exit code.

    @ivar script: the name of the failed script
    @ivar code: the exit code of the failed script
    cCs,||_||_tj||jƒƒdS(N(tscripttcodet	Exceptiont__init__t_get_message(tselfR	R
((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyRs		cCsd|j|jfS(Ns3Failed charm script: %s exited with return code %d.(R	R
(R((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyR
s(t__name__t
__module__t__doc__RR
(((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyRs	t
RunPartsErrorcBs eZdZd„Zd„ZRS(sË
    Raised when a charm-provided health script run-parts directory contains
    a health script that fails with a non-zero exit code.

    @ivar stderr: the stderr from the failed run-parts command
    cCs:d|jdƒdjƒ|_tj||jƒƒdS(Ns%st:i(tsplittstriptmessageRRR
(Rtstderr((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyR&s cCsd|jS(NsFailed charm script: %s.(R(R((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyR
*s(RRRRR
(((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyRs	t	HAServicecBsƒeZdZdZdZdZdZdZdZd„Z	d„Z
d	„Zd
„Zd„Z
d„Zd
„Zd„Zd„ZRS(sÏ
    Plugin to manage this computer's active participation in a
    high-availability cluster. It depends on charms delivering both health
    scripts and cluster_add cluster_remove scripts to function.
    s/var/lib/juju/unitstadd_to_clustertremove_from_clustershealth_checks.dustandbyuonlinecCs-tt|ƒj|ƒ|jd|jƒdS(Nschange-ha-service(tsuperRtregistertregister_messagethandle_change_ha_service(Rtregistry((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyR<s	cCsxidd6|d6|d6}|rbt|tƒsI|jddƒ|d<qb|jddƒ|d<n|jjj|tƒS(Nsoperation-resultttypetstatussoperation-idsutf-8treplacesresult-text(t
isinstancetunicodetdecodeRtbrokertsend_messagetTrue(RR!tdatatoperation_idR((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyt_respondAs

cCs tj|ƒ|jt||ƒS(N(tloggingtinfoR+R(RR)RR*((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyt_respond_successNs
cCs#t|ƒ|jt|jƒ|ƒS(sHandle exception failures.(RR+RtgetErrorMessage(RtfailureR*((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyt_respond_failureRs
cCs tj|ƒ|jt||ƒS(sOnly handle string failures.(R,terrorR+R(Rtfailure_stringR*((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyt_respond_failure_stringWs
cCs™d|j||jf}tjj|ƒsGttj|ƒƒdkrhd|}tj|ƒt	|ƒSd„}t
d|gdtjƒ}|j|ƒS(so
        Exercise any discovered health check scripts, will return a deferred
        success or fail.
        s%s/%s/charm/scripts/%sis4Skipping juju charm health checks. No scripts at %s.cSs2|\}}}|dkr*t|ƒ‚ndSdS(NisAll health checks succeeded.(R(t.0tstdout_datatstderr_dataR!((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pytparse_outputkss	run-partstenv(
tJUJU_UNITS_BASEtHEALTH_SCRIPTS_DIRtostpathtexiststlentlistdirR,R-RRtenvirontaddCallback(Rt	unit_patht
health_dirRR8tresult((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyt_run_health_checks\s.

	cCs‚d|j|f}|dkr/||j}n
||j}tjj|ƒsotjd||fƒtdƒSd„}||ƒS(sì
        Enables or disables a unit's participation in a cluster based on
        running charm-delivered CLUSTER_ONLINE and CLUSTER_STANDBY scripts
        if they exist. If the charm doesn't deliver scripts, return succeed().
        s%s/%s/charm/scripts/uonlinesTIgnoring juju charm cluster state change to '%s'. Charm script does not exist at %s.snThis computer is always a participant in its high-availabilty cluster. No juju charm cluster settings changed.cSs.t|dtjƒ}d„}|j||ƒS(NR9cSs*|dkrt||ƒ‚nd|SdS(Nis
%s succeeded.(R(R
R	((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pytvalidate_exit_codes(RR<RARB(R	RERG((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyt
run_scriptŠs	(	R:tCLUSTER_ONLINEtCLUSTER_STANDBYR<R=R>R,R-R(Rt_RCt
service_statetunit_dirR	RH((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyt_change_cluster_participationus
		
cCsGtdƒ}||jkr-|j|ƒ}n|j|j||ƒ|S(s
        Handle specific state change requests through calls to available
        charm scripts like C{CLUSTER_ONLINE}, C{CLUSTER_STANDBY} and any
        health check scripts. Assume success in any case where no scripts
        exist for a given task.
        N(RtNonetSTATE_ONLINERFRBRN(RRCRLR*td((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyt_perform_state_change–scCsC|d}yd}|d}|d}|d}d||f}||j|jgkrfd|}n|jdd	ƒ}d
|j|f}	tjj|jƒs©d}ntjj|	ƒsÈd|}n|rÞ|j||ƒS|j|||ƒ}
|
j	|j
||ƒ|
j|j|ƒ|
SWn|jt
ƒ|ƒ|
SXd
S(s)Parse incoming change-ha-service messagessoperation-idusservice-names	unit-names
service-states&%s high-availability service set to %su1Invalid cluster participation state requested %s.t/t-s%s/%s/charmuZThis computer is not deployed with juju. Changing high-availability service not supported.uOThis computer is not juju unit %s. Unable to modify high-availability services.N(t
STATE_STANDBYRPR"R:R<R=R>R4RRRBR.t
addErrbackR1R(RRR*t
error_messagetservice_namet	unit_nameRLtchange_messageRCRMRQ((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyR¦s:





	

(RRRR:RIRJR;RURPRR+R.R1R4RFRNRRR(((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyR.s 		
					!	(R,R<ttwisted.python.failureRttwisted.internet.utilsRRttwisted.internet.deferRtlandscape.lib.logRtlandscape.manager.pluginRRRRRRR(((s?/usr/lib/python2.7/dist-packages/landscape/manager/haservice.pyt<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit