Merge lp:~therve/landscape-client/no-changer-no-proxy into lp:~landscape/landscape-client/trunk

Proposed by Thomas Herve
Status: Merged
Approved by: Jamu Kakar
Approved revision: 272
Merged at revision: 272
Proposed branch: lp:~therve/landscape-client/no-changer-no-proxy
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 32 lines (+14/-11)
1 file modified
scripts/landscape-dbus-proxy (+14/-11)
To merge this branch: bzr merge lp:~therve/landscape-client/no-changer-no-proxy
Reviewer Review Type Date Requested Status
Jamu Kakar (community) Approve
Kevin McDermott (community) Approve
Review via email: mp+29564@code.launchpad.net

Description of the change

This is a rather trivial fix: we just need to check that the directory exists before trying to lock the file.

To post a comment you must log in.
Revision history for this message
Kevin McDermott (bigkevmcd) wrote :

Trivial fix indeed :-)

review: Approve
Revision history for this message
Jamu Kakar (jkakar) wrote :

It'd be better if there were tests for this code, but I think we can
leave that for the future. Thanks for the quick fix, +1!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/landscape-dbus-proxy'
2--- scripts/landscape-dbus-proxy 2010-06-10 18:26:18 +0000
3+++ scripts/landscape-dbus-proxy 2010-07-09 14:52:58 +0000
4@@ -66,14 +66,17 @@
5 connected.addCallback(cb_connected)
6
7
8-config = Configuration()
9-lock_filename = os.path.join(config.data_path, "package", "changer.lock")
10-try:
11- lock_path(lock_filename)
12-except LockError:
13- # The package-changer is running, this means that we're upgrading from
14- # a non-AMP version and that the upgrade is Landscape driven, so let's
15- # expose the DBus broker proxy to give a chance to the package-changer
16- # to send its result message.
17- remote = BrokerDBusObject(config)
18- reactor.run()
19+if __name__ == "__main__":
20+ config = Configuration()
21+ lock_dir = os.path.join(config.data_path, "package")
22+ if os.path.isdir(lock_dir):
23+ lock_filename = os.path.join(lock_dir, "changer.lock")
24+ try:
25+ lock_path(lock_filename)
26+ except LockError:
27+ # The package-changer is running, this means that we're upgrading from
28+ # a non-AMP version and that the upgrade is Landscape driven, so let's
29+ # expose the DBus broker proxy to give a chance to the package-changer
30+ # to send its result message.
31+ remote = BrokerDBusObject(config)
32+ reactor.run()

Subscribers

People subscribed via source and target branches

to all changes: