Merge lp:~stub/charms/precise/postgresql/cleanups into lp:charms/postgresql

Proposed by Stuart Bishop
Status: Merged
Approved by: Stuart Bishop
Approved revision: 82
Merged at revision: 69
Proposed branch: lp:~stub/charms/precise/postgresql/cleanups
Merge into: lp:charms/postgresql
Prerequisite: lp:~stub/charms/precise/postgresql/charm-helpers
Diff against target: 58 lines (+10/-10)
1 file modified
test.py (+10/-10)
To merge this branch: bzr merge lp:~stub/charms/precise/postgresql/cleanups
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+190473@code.launchpad.net

Description of the change

More delinting.

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test.py'
2--- test.py 2013-08-23 08:03:02 +0000
3+++ test.py 2013-10-10 20:10:15 +0000
4@@ -115,7 +115,7 @@
5 agent_state = units[unit].get('agent-state', '')
6 if agent_state == 'error':
7 raise RuntimeError('{} error: {}'.format(
8- unit, units[unit].get('agent-state-info','')))
9+ unit, units[unit].get('agent-state-info', '')))
10 if agent_state != 'started':
11 ready = False
12 # Unfortunately, there is no way to tell when a system is
13@@ -262,7 +262,8 @@
14 return result
15
16 def pg_ctlcluster(self, unit, command):
17- cmd = ['juju', 'ssh', unit,
18+ cmd = [
19+ 'juju', 'ssh', unit,
20 # Due to Bug #1191079, we need to send the whole remote command
21 # as a single argument.
22 'sudo pg_ctlcluster 9.1 main -force {}'.format(command)]
23@@ -308,9 +309,9 @@
24 # Even on a freshly setup service, we have no idea which unit
25 # will become the master as we have no control over which two
26 # units join the peer relation first.
27- units = sorted((self.is_master(unit), unit)
28- for unit in
29- self.juju.status['services']['postgresql']['units'].keys())
30+ units = sorted(
31+ (self.is_master(unit), unit) for unit in
32+ self.juju.status['services']['postgresql']['units'].keys())
33 self.assertFalse(units[0][0])
34 self.assertFalse(units[1][0])
35 self.assertTrue(units[2][0])
36@@ -396,9 +397,9 @@
37 # Even on a freshly setup service, we have no idea which unit
38 # will become the master as we have no control over which two
39 # units join the peer relation first.
40- units = sorted((self.is_master(unit, 'postgres'), unit)
41- for unit in
42- self.juju.status['services']['postgresql']['units'].keys())
43+ units = sorted(
44+ (self.is_master(unit, 'postgres'), unit) for unit in
45+ self.juju.status['services']['postgresql']['units'].keys())
46 self.assertFalse(units[0][0])
47 self.assertFalse(units[1][0])
48 self.assertTrue(units[2][0])
49@@ -439,8 +440,7 @@
50 def unit_sorted(units):
51 """Return a correctly sorted list of unit names."""
52 return sorted(
53- units, lambda a,b:
54- cmp(int(a.split('/')[-1]), int(b.split('/')[-1])))
55+ units, lambda a, b: cmp(int(a.split('/')[-1]), int(b.split('/')[-1])))
56
57
58 if __name__ == '__main__':

Subscribers

People subscribed via source and target branches