Merge lp:~fnordahl/charm-helpers/fix-occasional-keyerror into lp:charm-helpers

Proposed by Frode Nordahl
Status: Needs review
Proposed branch: lp:~fnordahl/charm-helpers/fix-occasional-keyerror
Merge into: lp:charm-helpers
Diff against target: 13 lines (+3/-0)
1 file modified
charmhelpers/contrib/openstack/amulet/utils.py (+3/-0)
To merge this branch: bzr merge lp:~fnordahl/charm-helpers/fix-occasional-keyerror
Reviewer Review Type Date Requested Status
Felipe Reyes (community) Disapprove
charmers Pending
Review via email: mp+318594@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Felipe Reyes (freyes) wrote :
review: Disapprove

Unmerged revisions

700. By Frode Nordahl

[fnordahl] Avoid KeyError in the event of incomplete relation

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/openstack/amulet/utils.py'
2--- charmhelpers/contrib/openstack/amulet/utils.py 2017-02-27 22:11:45 +0000
3+++ charmhelpers/contrib/openstack/amulet/utils.py 2017-03-01 12:29:04 +0000
4@@ -322,6 +322,9 @@
5 rel = sentry.relation('identity-service',
6 relation_name)
7 self.log.debug('keystone relation data: {}'.format(rel))
8+ if not 'api_version' in rel:
9+ raise Exception("no api_version in relation data ('{}')."
10+ "".format(rel))
11 if rel['api_version'] != str(api_version):
12 raise Exception("api_version not propagated through relation"
13 " data yet ('{}' != '{}')."

Subscribers

People subscribed via source and target branches