Merge lp:~stub/charms/trusty/cassandra/bug-1555261-fix-null-username into lp:charms/trusty/cassandra

Proposed by Stuart Bishop
Status: Merged
Merge reported by: Stuart Bishop
Merged at revision: not available
Proposed branch: lp:~stub/charms/trusty/cassandra/bug-1555261-fix-null-username
Merge into: lp:charms/trusty/cassandra
Diff against target: 16 lines (+6/-0)
1 file modified
hooks/actions.py (+6/-0)
To merge this branch: bzr merge lp:~stub/charms/trusty/cassandra/bug-1555261-fix-null-username
Reviewer Review Type Date Requested Status
Review Queue (community) automated testing Needs Fixing
charmers Pending
Review via email: mp+291584@code.launchpad.net

Description of the change

Fix Bug #1555261, where we could generate usernames such as 'juju_None'.

A race condition exists such that the remote service name may be unknown in the client relation-joined and relation-changed hooks. In this case, we should do nothing and wait until related units actually exist in a future relation-changed hook.

To post a comment you must log in.
Revision history for this message
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-aws/3657/

review: Needs Fixing (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws:8080/job/charm-bundle-test-lxc/3604/

review: Needs Fixing (automated testing)
Revision history for this message
Stuart Bishop (stub) wrote :

Now in the charmstore

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/actions.py'
2--- hooks/actions.py 2016-03-17 10:54:10 +0000
3+++ hooks/actions.py 2016-04-12 07:35:55 +0000
4@@ -663,6 +663,12 @@
5 # even after the relation is dropped and recreated, or the
6 # juju environment rebuild and the database restored from
7 # backups.
8+ service_name = helpers.get_service_name(relid)
9+ if not service_name:
10+ # Per Bug #1555261, we might not yet have related units,
11+ # so no way to calculate the remote service name and thus
12+ # the user.
13+ return # Try again later.
14 username = 'juju_{}'.format(helpers.get_service_name(relid))
15 if superuser:
16 username += '_admin'

Subscribers

People subscribed via source and target branches

to all changes: