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/rebootrequired.pyc

ó
ÍÿŠTc@sXddlZddlZddlmZddlmZdZdefd„ƒYZdS(iÿÿÿÿN(t	read_file(t
MonitorPlugins/var/run/reboot-requiredtRebootRequiredcBs_eZdZdZdZdZeZed„Z	d„Z
d„Zd„Zd„Z
d	„ZRS(
s±
    Report whether the system requires a reboot.

    @param reboot_required_filename: The path to the flag file that indicates
        if the system needs to be rebooted.
    sreboot-requiredtpackagei„cCs||_|d|_dS(Ns.pkgs(t_flag_filenamet_packages_filename(tselftreboot_required_filename((sD/usr/lib/python2.7/dist-packages/landscape/monitor/rebootrequired.pyt__init__s	cCstjj|jƒS(s@Return a boolean indicating whether the computer needs a reboot.(tostpathtexistsR(R((sD/usr/lib/python2.7/dist-packages/landscape/monitor/rebootrequired.pyt	_get_flagscCsNtjj|jƒsgSt|jƒjƒ}td„|Dƒƒ}t|ƒS(s;Return the list of packages that required a reboot, if any.css*|] }|r|jƒjdƒVqdS(sutf-8N(tstriptdecode(t.0tline((sD/usr/lib/python2.7/dist-packages/landscape/monitor/rebootrequired.pys	<genexpr>&s(R	R
RRRt
splitlinestsettsorted(Rtlinestpackages((sD/usr/lib/python2.7/dist-packages/landscape/monitor/rebootrequired.pyt
_get_packages s
cCs†i}|jƒ}|jƒ}xad|fd|fgD]G\}}||jj|ƒkraq7n|jj||ƒ|||<q7W|S(s:Return the body of the reboot-required message to be sent.tflagR(RRt_persisttgetR(RtmessageRRtkeytvalue((sD/usr/lib/python2.7/dist-packages/landscape/monitor/rebootrequired.pyt_create_message)s%cCsO|jƒ}|rKd|d<tjdƒ|jjj||jdtƒndS(s˜Send a reboot-required message if needed.

        A message will be sent only if the reboot-required status of the
        system has changed.
        sreboot-required-infottypes5Queueing message with updated reboot-required status.turgentN(Rtloggingtinfotregistrytbrokertsend_messaget_session_idtTrue(RR((sD/usr/lib/python2.7/dist-packages/landscape/monitor/rebootrequired.pyR$5s

cCs|jjjd|jƒS(s9Send reboot-required messages if the server accepts them.sreboot-required-info(R"R#tcall_if_acceptedR$(R((sD/usr/lib/python2.7/dist-packages/landscape/monitor/rebootrequired.pytrunCs(t__name__t
__module__t__doc__tpersist_nametscopetrun_intervalR&trun_immediatelytREBOOT_REQUIRED_FILENAMERRRRR$R((((sD/usr/lib/python2.7/dist-packages/landscape/monitor/rebootrequired.pyRs					(R	R tlandscape.lib.fsRtlandscape.monitor.pluginRR0R(((sD/usr/lib/python2.7/dist-packages/landscape/monitor/rebootrequired.pyt<module>s