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/package/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/landscape/package/changer.pyc

}9Rc@sddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZddlmZddlmZddlmZddlmZmZmZmZdd	lm Z dd
l!m"Z"ddl#m$Z$de%fd
YZ&defdYZ'de(fdYZ)defdYZ*dZ+dZ,dS(iN(t
maybeDeferredtsucceed(treactor(tSUCCESS_RESULTtERROR_RESULTtDEPENDENCY_ERROR_RESULTt
POLICY_STRICTtPOLICY_ALLOW_INSTALLStPOLICY_ALLOW_ALL_CHANGEStUNKNOWN_PACKAGE_DATA_TIMEOUT(tcreate_file(tlog_failure(tfind_reporter_command(tPackageTaskHandlertPackageTaskHandlerConfigurationtPackageTaskErrortrun_task_handler(tFAILED(tShutdownProcessProtocol(tREBOOT_REQUIRED_FILENAMEtUnknownPackageDatacBseZdZRS(s(Raised when an ID or a hash isn't known.(t__name__t
__module__t__doc__(((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyRstPackageChangerConfigurationcBseZdZedZRS(s<Specialized configuration for the Landscape package-changer.cCstjj|jdS(s@The path to the directory we store server-generated packages in.tbinaries(tostpathtjointpackage_directory(tself((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyt
binaries_path#s(RRRtpropertyR(((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR stChangePackagesResultcBseZdZdZRS(sValue object to hold the results of change packages operation.

    @ivar code: The result code of the requested changes.
    @ivar text: The output from Apt.
    @ivar installs: Possible additional packages that need to be installed
        in order to fulfill the request.
    @ivar removals: Possible additional packages that need to be removed
        in order to fulfill the request.
    cCs(d|_d|_g|_g|_dS(N(tNonetcodettexttinstallstremovals(R((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyt__init__4s			(RRRR'(((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR!)s	tPackageChangercBseZdZeZdZededZ	dZ
dZdZdZ
dZdZdd	Zedddded
ZdZdZd
ZdZdZdZedZdZedZRS(s%Install, remove and upgrade packages.tchangerc	Csitt|j||||||_|dkrSddlm}||_n	||_||_dS(Ni(tLandscapeReactor(	tsuperR(R't_process_factoryR"tlandscape.reactorR*t_landscape_reactortreboot_required_filename(	Rtstoretfacadetremotetconfigtprocess_factorytlandscape_reactorR/R*((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR'Bs		cs_js#tjdtdSj}|jfd|jfd|S(sV
        Handle our tasks and spawn the reporter if package data has changed.
        s-The package-reporter hasn't run yet, exiting.cs
jS(N(thandle_tasks(tx(R(s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyt<lambda>Wscs
jS(N(trun_package_reporter(R7(R(s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR8XsN(tupdate_stamp_existstloggingtwarningRR"tuse_hash_id_dbtaddCallback(Rtresult((Rs=/usr/lib/python2.7/dist-packages/landscape/package/changer.pytrunNs

cCs|jdkrdStjdkrZtjtjdjtjtj	dj
nt}|jj
dk	r|d|jj
7}ntj|dS(sX
        Run the L{PackageReporter} if there were successfully completed tasks.
        iNt	landscapes -c %s(thandled_tasks_countRtgetuidtsetgidtgrptgetgrnamtgr_gidtsetuidtpwdtgetpwnamtpw_uidRt_configR3R"tsystem(Rtcommand((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR9[s	cCs_|j}|ddkr>t|j|}|j|j|S|ddkr[|j|SdS(sl
        @param task: A L{PackageTask} carrying a message of
            type C{"change-packages"}.
        ttypeschange-packagesschange-package-locksN(tdataRthandle_change_packagest
addErrbacktunknown_package_data_errorthandle_change_package_locks(RttasktmessageR?((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pythandle_taskks	cCs|jttjd|jjd|jtjtkrzidd6|j	dd6t
d6dd6}|jj|St
d	S(
s}Handle L{UnknownPackageData} data errors.

        If the task is older than L{UNKNOWN_PACKAGE_DATA_TIMEOUT} seconds,
        a message is sent to the server to notify the failure of the associated
        activity and the task will be removed from the queue.

        Otherwise a L{PackageTaskError} is raised and the task will be picked
        up again at the next run.
        s2Package data not yet synchronized with server (%r)ischange-packages-resultROsoperation-idsresult-codes5Package data has changed. Please retry the operation.sresult-textN(ttrapRR;R<tvaluetargst	timestampttimeR	RPRt_brokertsend_messageR(RtfailureRURV((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyRSws

	

cCs+tjj|jjp*tjj|jS(sT
        Return a boolean indicating if the update-stamp stamp file exists.
        (RRtexistsRLtupdate_stamp_filenametupdate_notifier_stamp(R((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR:scCsS|jj}x3tj|D]"}tjtjj||qW|jjdS(s/Remove any binaries and its associated channel.N(	RLRRtlistdirtremoveRRt_facadetclear_channels(RRtexisting_deb_path((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyt_clear_binariess cCs|jj}|j|ri}xJ|D]B\}}}ttjj|d|tj||||<q)W|j	j
||jj||jj
dtn|jjdS(sInitialize the Apt channels as needed.

        @param binaries: A possibly empty list of 3-tuples of the form
            (hash, id, deb), holding the hash, the id and the content of
            additional Debian packages that should be loaded in the channels.
        s%d.debtforce_reload_binariesN(RLRRhR
RRRtbase64tdecodestringt_storetset_hash_idsRetadd_channel_deb_dirtreload_channelstTruetensure_channels_reloaded(RRRthash_idsthashtidtdeb((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyt
init_channelss
cCs|r|jjn|r,|jjnx|jj|f|jj|f|jj|f|jj|fgD]\}}xr|D]j}	|jj|	}
|
dkrt
|	n|jj|
}|dkrt
|
n||qWqoWdS(sMark packages for upgrade, installation or removal.

        @param upgrade: If C{True} mark all installed packages for upgrade.
        @param install: A list of package ids to be marked for installation.
        @param remove: A list of package ids to be marked for removal.
        @param hold: A list of package ids to be marked for holding.
        @param remove_hold: A list of package ids to be marked to have a hold
                            removed.
        @param reset: If C{True} all existing marks will be reset.
        N(Retreset_markstmark_global_upgradetmark_installtmark_removet	mark_holdtmark_remove_holdRltget_id_hashR"Rtget_package_by_hash(RtupgradetinstallRdtholdtremove_holdtresett
mark_functiontmark_idstmark_idRstpackage((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyt
mark_packagess"
c
Cs}ddlm}m}t}d}xQ|jdkrx|d7}y|jj|_Wn|k
r}t	|_|j
d|_q(|k
rk}x|jD]z}|jj|}|j
j|}	|	dkrt|n|jj|r|jj|	q|jj|	qW|dkr_|j||r_|jd|jd|jdtqut|_q(Xt|_q(W|S(	stPerform the requested changes.

        @param policy: A value indicating what to do in case additional changes
            beside the ones explicitly requested are needed in order to fulfill
            the request (see L{complement_changes}).
        @return: A L{ChangePackagesResult} holding the details about the
            outcome of the requested changes.
        i(tDependencyErrortTransactionErroriiRRdRN(tlandscape.package.facadeRRR!R#R"Retperform_changesR$RRZtpackagestget_package_hashRltget_hash_idRtis_package_installedR&tappendR%tmay_complement_changesRtFalseRR(
RtpolicyRRR?tcountt	exceptionRRsRt((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pytchange_packagess2	
	

cCs:|tkrtS|tkr6|jr6|jr6tSntS(saDecide whether or not we should complement the given changes.

        @param result: A L{PackagesResultObject} holding the details about the
            missing dependencies needed to complement the given changes.
        @param policy: It can be one of the following values:
            - L{POLICY_STRICT}, no additional packages will be marked.
            - L{POLICY_ALLOW_INSTALLS}, if only additional installs are missing
                they will be marked for installation.
        @return: A boolean indicating whether the given policy allows to
            complement the changes and retry.
        (RRpRR%R&R(RR?R((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyRsc
Cs|j|jdd|jd|jdtd|jdd
d|jddd|jddd|jdd|j|jd	t}|j|jd
otjj	|j
}|}|jd||d|}|r|j
|jn|S(s$Handle a C{change-packages} message.RRsupgrade-allRRdRRsremove-holdRsreboot-if-necessarytstop_exchanger(((((N(RvtgetRRRRRhRRR`R/t_send_responseR"R>t
_reboot_later(RRVR?tneeds_rebootRtdeferred((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyRQs 
	
cCs|jjd|jdS(Ni(R.t
call_latert_run_reboot(RR?((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR9scCszt}d}|j|j|jj|j||jjtddd|dg}|jj	|dd||jS(sU
        Create a C{ShutdownProcessProtocol} and return its result deferred.
        tnowsReboot failed.s/sbin/shutdowns-rs!Landscape is rebooting the systemRZ(
Rtset_timeoutR.R?R>t_log_rebootRRRR,tspawnProcess(RtprotocoltminutesRZ((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR<s				cCstjd|dS(sLog the reboot.s/Landscape is rebooting the system in %s minutesN(R;R<(RR?R((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyRKscsidd6|jdd6}|j|d<|jrC|j|d<n|jrbt|j|d<n|jrt|j|d<ntjdjj	|t
}|rtjd	|jfd
n|S(s?
        Create a response and dispatch to the broker.
        schange-packages-resultROsoperation-idsresult-codesresult-textsmust-installsmust-removesBQueuing response with change package results to exchange urgently.s*stopping exchanger due to imminent reboot.cs
jjS(N(R]R(t_(R(s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR8fs(RR#R$R%tsortedR&R;tinfoR]R^RpR>(Rt
reboot_resultRVtpackage_change_resultRtresponseR((Rs=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyRPs

			

cCsEidd6|jdd6td6dd6dd6}|jj|tS(	scHandle a C{change-package-locks} message.

        Package locks aren't supported anymore.
        soperation-resultROsoperation-idtstatuss*This client doesn't support package locks.sresult-textisresult-code(RRR]R^Rp(RRVR((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyRTis
cCstS(N(tfind_changer_command(((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pytfind_commandwsN((((((RRRRtconfig_factoryt
queue_nameRR"RR'R@R9RWRSR:RhRvRRpRRRRQRRRRRTtstaticmethodR(((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR(;s0
	
								/						cCs8tjjtjjtjd}tjj|dS(Nislandscape-package-changer(RRtdirnametabspathtsystargvR(R((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyR|s%cCs2tjtjkr%tjntt|S(N(RtgetpgrptgetpidtsetsidRR((RZ((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pytmains
(-R;RjR\RRRIREttwisted.internet.deferRRttwisted.internetRtlandscape.constantsRRRRRRR	tlandscape.lib.fsR
tlandscape.lib.logRtlandscape.package.reporterRtlandscape.package.taskhandlerR
RRRtlandscape.manager.managerRt!landscape.manager.shutdownmanagerRt landscape.monitor.rebootrequiredRt	ExceptionRRtobjectR!R(RR(((s=/usr/lib/python2.7/dist-packages/landscape/package/changer.pyt<module>s.4"	B	

Youez - 2016 - github.com/yon3zu
LinuXploit