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
=== modified file 'hooks/actions.py'
--- hooks/actions.py 2016-03-17 10:54:10 +0000
+++ hooks/actions.py 2016-04-12 07:35:55 +0000
@@ -663,6 +663,12 @@
663 # even after the relation is dropped and recreated, or the663 # even after the relation is dropped and recreated, or the
664 # juju environment rebuild and the database restored from664 # juju environment rebuild and the database restored from
665 # backups.665 # backups.
666 service_name = helpers.get_service_name(relid)
667 if not service_name:
668 # Per Bug #1555261, we might not yet have related units,
669 # so no way to calculate the remote service name and thus
670 # the user.
671 return # Try again later.
666 username = 'juju_{}'.format(helpers.get_service_name(relid))672 username = 'juju_{}'.format(helpers.get_service_name(relid))
667 if superuser:673 if superuser:
668 username += '_admin'674 username += '_admin'

Subscribers

People subscribed via source and target branches

to all changes: