Merge lp:~mvo/aptdaemon/reboot-required-property into lp:aptdaemon

Proposed by Michael Vogt
Status: Merged
Merged at revision: 663
Proposed branch: lp:~mvo/aptdaemon/reboot-required-property
Merge into: lp:aptdaemon
Diff against target: 60 lines (+19/-1)
2 files modified
aptdaemon/core.py (+13/-1)
doc/source/dbus.rst (+6/-0)
To merge this branch: bzr merge lp:~mvo/aptdaemon/reboot-required-property
Reviewer Review Type Date Requested Status
Aptdaemon Developers Pending
Review via email: mp+69631@code.launchpad.net

Description of the change

This adds a reboot required property to aptdaemon so that tools like the indicators can
watch for a reboot required property change signal.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'aptdaemon/core.py'
2--- aptdaemon/core.py 2011-06-27 08:11:41 +0000
3+++ aptdaemon/core.py 2011-07-28 12:03:27 +0000
4@@ -1274,11 +1274,18 @@
5 self.worker = AptWorker(options.chroot)
6 self.queue = TransactionQueue(self.worker)
7 self.queue.connect("queue-changed", self._on_queue_changed)
8+ # keep state of the last information about reboot required
9+ self._reboot_required = self._get_is_reboot_required()
10 log.debug("Setting up worker thread")
11 log.debug("Daemon was initialized")
12
13 def _on_queue_changed(self, queue):
14 """Callback for a changed transaction queue."""
15+ # check for reboot required
16+ if self._get_is_reboot_required() != self._reboot_required:
17+ self._reboot_required = self._get_is_reboot_required()
18+ self.PropertyChanged("RebootRequired", self._reboot_required)
19+ # check for the queue
20 if self.queue.worker.trans:
21 current = self.queue.worker.trans.tid
22 else:
23@@ -1886,6 +1893,9 @@
24 with open(_POPCON_PATH, "w") as conf_file:
25 conf_file.write(config)
26
27+ def _get_is_reboot_required(self):
28+ return os.path.exists("/var/run/reboot-required")
29+
30 def _get_popcon_participation(self):
31 #FIXME: Use a script to evaluate the configuration:
32 # #!/bin/sh
33@@ -1920,7 +1930,9 @@
34 "Unattended-Upgrade",
35 False)),
36 "PopConParticipation": dbus.Boolean(
37- self._get_popcon_participation())
38+ self._get_popcon_participation()),
39+ "RebootRequired": dbus.Boolean(
40+ self._get_is_reboot_required())
41 }
42 else:
43 return {}
44
45=== modified file 'doc/source/dbus.rst'
46--- doc/source/dbus.rst 2011-06-27 08:11:41 +0000
47+++ doc/source/dbus.rst 2011-07-28 12:03:27 +0000
48@@ -112,6 +112,12 @@
49
50 *writable*
51
52+.. attribute:: RebootRequired : b
53+
54+ Set if a reboot is required in order to complete the update.
55+
56+ *readonly*
57+
58
59 org.debian.apt.transaction --- The transaction interface
60 --------------------------------------------------------

Subscribers

People subscribed via source and target branches

to status/vote changes: