Your IP : 172.28.240.42


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

ó
ÍÿŠTc@srddlZddlZddlmZddlmZddlmZddlm	Z	de	fd„ƒYZ
dS(iÿÿÿÿN(tgetProcessOutput(tPackageStore(tfind_reporter_command(t
MonitorPlugintPackageMonitorcBsqeZdZdZdd„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd	„Zd
„Z
d„ZRS(
itpackagecCsDtt|ƒjƒ|r+t|ƒ|_n	d|_tƒ|_dS(N(tsuperRt__init__Rt_package_storetNoneRt_reporter_command(tselftpackage_store_filename((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyRs
	cCsÕ|j|_|jj|_|jjr?|jjr?d|_ntt|ƒj|ƒ|js‹t	j
j|jjdƒ}t
|ƒ|_n|jd|jƒ|jjd|jƒ|jd|jƒ|jƒdS(Ni<spackage/databasespackage-idssserver-uuid-changedtpackages(tconfigtpackage_monitor_intervaltrun_intervaltclonestis_cloneRRtregisterRtostpathtjoint	data_pathRtregister_messaget!_enqueue_message_as_reporter_tasktreactortcall_ont_server_uuid_changedtcall_on_acceptedtspawn_reportertrun(Rtregistrytfilename((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyRs			

cCs!|jjd|ƒ|jƒdS(Ntreporter(Rtadd_taskR(Rtmessage((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyR,scCs&|jjjƒ}|j|jƒ|S(N(R tbrokertget_accepted_message_typestaddCallbackt_got_message_types(Rtresult((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyR0scCsd|kr|jƒndS(NR
(R(Rt
message_types((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyR(5scsCdtfd„ƒY}tˆdd
ƒd
krìddlm}m}ddlm}|ƒ}|ƒ}|j|dˆj	j
dˆj	jgƒ||jƒ}|||ˆj
j|ƒˆ_tjjˆj	jd	d
ƒˆj_tˆ_nˆjrddlm}	|	d
ƒStˆ_ˆjjƒ}
‡fd†}|
j|ƒS(sRun a fake-reporter in-process.t
FakeFacadecBseZdZd„ZRS(s‘
            A fake facade to workaround the issue that the AptFacade
            essentially allows only once instance per process.
            cSsotjƒd}idd6dd6dd6j|ƒ}|rC|}n(|ddkrk|jd	ƒrkd}n|S(
Niÿÿÿÿti386tpentiumti86pctamd64tx86_64itit86(Rtunametgettendswith(RtarchR)((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pytget_archBs
		(t__name__t
__module__t__doc__R7(((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyR+<st_fake_reporteriÿÿÿÿ(tFakeReportertPackageReporterConfiguration(tFakePackageStores-ds-lRtdatabase(tsucceedcs
tˆ_|S(N(tFalset_fake_reporter_running(tpassthrough(R(sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pytdonees	N(tobjecttgetattrR	tlandscape.package.reporterR<R=tlandscape.package.storeR>tloadRRtlog_dirtstore_filenameR R%R;RRRtmaster_data_pathtglobal_store_filenameRARBttwisted.internet.deferR@tTrueRtaddBoth(RtargsR+R<R=R>tpackage_facadetpackage_configt
package_storeR@R)RD((RsD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyt_run_fake_reporter9s,						
	c
Cs³dg}|jjr1|jd|jjgƒntjjƒ}|jjdkrx|jjrk|j|ƒSd|d<nt|j	d|d|dd	d
dƒ}|j|jƒ|S(Ns--quiets-cit1tFAKE_GLOBAL_PACKAGE_STORERQtenvterrortooiR(
RtextendRtenvirontcopyRRRURR
R	R't_got_reporter_output(RRQRXR)((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyRks	

	cCs|rtjd|ƒndS(NsPackage reporter output:
%s(tloggingtwarning(Rtoutput((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyR]€scCs6|jjdidd6ƒ}|jjd|fƒdS(s:
        Remove all tasks *except* the resynchronize task.  This is
        because if we clear all tasks, then add the resynchronize,
        it's possible that the reporter may be running a task at this
        time and when it finishes, it will unknowningly remove the
        resynchronize task because sqlite resets its serial primary
        keys when you delete an entire table.  This problem is avoided
        by adding the task first and removing them all *except* the
        resynchronize task and not causing sqlite to reset the serial
        key.
        R"t
resynchronizettypetexcept_tasksN(RR#tclear_tasks(Rttask((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyt_reset„scCs |dk	r|jjƒndS(sµCalled when the broker sends a server-uuid-changed event.

        The package hash=>id map is server-specific, so when we change
        servers, we should reset this map.
        N(R	Rtclear_hash_ids(Rtold_uuidtnew_uuid((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyR”s	N(R8R9RtscopeR	RRRRR(RURR]RfR(((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyRs					2			(R^Rttwisted.internet.utilsRRHRRGRtlandscape.monitor.pluginRR(((sD/usr/lib/python2.7/dist-packages/landscape/monitor/packagemonitor.pyt<module>s