Merge lp:~stub/charms/precise/postgresql/bug-1190141-client-access-fail into lp:charms/postgresql

Proposed by Stuart Bishop
Status: Merged
Approved by: Mark Mims
Approved revision: 69
Merged at revision: 53
Proposed branch: lp:~stub/charms/precise/postgresql/bug-1190141-client-access-fail
Merge into: lp:charms/postgresql
Prerequisite: lp:~stub/charms/precise/postgresql/tests
Diff against target: 24 lines (+8/-4)
1 file modified
hooks/hooks.py (+8/-4)
To merge this branch: bzr merge lp:~stub/charms/precise/postgresql/bug-1190141-client-access-fail
Reviewer Review Type Date Requested Status
Mark Mims (community) Approve
Review via email: mp+169928@code.launchpad.net

Description of the change

Restore basic functionality to the charm by actually granting clients access.

Tests now pass (all one of them):

$ TEST_DEBUG_FILE=debug.log TEST_TIMEOUT=600 ./test.py -vv
test_basic (__main__.PostgreSQLCharmTestCase)
__main__.PostgreSQLCharmTestCase.test_basic ... ok

----------------------------------------------------------------------
Ran 1 test in 635.891s

OK

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

Running the tests requires local:postgresql-psql from lp:~stub/charms/precise/postgresql-psql/devel (up for review elsewhere).

62. By Stuart Bishop

Merged tests into bug-1190141-client-access-fail.

63. By Stuart Bishop

Merged tests into bug-1190141-client-access-fail.

64. By Stuart Bishop

Merged tests into bug-1190141-client-access-fail.

65. By Stuart Bishop

Merged tests into bug-1190141-client-access-fail.

66. By Stuart Bishop

Merged tests into bug-1190141-client-access-fail.

67. By Stuart Bishop

Merged tests into bug-1190141-client-access-fail.

68. By Stuart Bishop

Merged tests into bug-1190141-client-access-fail.

69. By Stuart Bishop

Merged tests into bug-1190141-client-access-fail.

Revision history for this message
Mark Mims (mark-mims) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/hooks.py'
2--- hooks/hooks.py 2013-06-20 14:25:33 +0000
3+++ hooks/hooks.py 2013-06-20 14:25:34 +0000
4@@ -622,13 +622,17 @@
5 for relid in relation_ids(relation_types=['db', 'db-admin']):
6 local_relation = relation_get(
7 unit_name=os.environ['JUJU_UNIT_NAME'], relation_id=relid)
8+
9+ # We might see relations that have not yet been setup enough.
10+ # At a minimum, the relation-joined hook needs to have been run
11+ # on the server so we have information about the usernames and
12+ # databases to allow in.
13+ if 'user' not in local_relation:
14+ continue
15+
16 for unit in relation_list(relid):
17 relation = relation_get(unit_name=unit, relation_id=relid)
18
19- # If a relation is not yet completely setup, skip it.
20- if 'user' not in relation:
21- continue
22-
23 relation['relation-id'] = relid
24 relation['unit'] = unit
25

Subscribers

People subscribed via source and target branches