Merge lp:~1chb1n/charm-helpers/lp1679444 into lp:charm-helpers

Proposed by Ryan Beisner
Status: Needs review
Proposed branch: lp:~1chb1n/charm-helpers/lp1679444
Merge into: lp:charm-helpers
Diff against target: 20 lines (+9/-1)
1 file modified
charmhelpers/contrib/openstack/utils.py (+9/-1)
To merge this branch: bzr merge lp:~1chb1n/charm-helpers/lp1679444
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+321808@code.launchpad.net

Description of the change

Improve clarity when unit series mismatches UCA config value re: bug 1679444

To post a comment you must log in.

Unmerged revisions

732. By Ryan Beisner

Improve clarity when unit series mismatches UCA config value

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/openstack/utils.py'
2--- charmhelpers/contrib/openstack/utils.py 2017-03-24 16:50:31 +0000
3+++ charmhelpers/contrib/openstack/utils.py 2017-04-04 03:34:28 +0000
4@@ -287,7 +287,15 @@
5
6 if src.startswith('cloud:'):
7 ca_rel = src.split(':')[1]
8- ca_rel = ca_rel.split('%s-' % ubuntu_rel)[1].split('/')[0]
9+ if ubuntu_rel in ca_rel and '/' in ca_rel:
10+ ca_rel = ca_rel.split('%s-' % ubuntu_rel)[1].split('/')[0]
11+ else:
12+ # Improve clarity when unit series mismatches UCA config value
13+ # https://bugs.launchpad.net/bugs/1679444
14+ msg = ('Invalid Cloud Archive release value ({}) for '
15+ 'Ubuntu release ({})'.format(ca_rel, ubuntu_rel))
16+ juju_log(msg, level=ERROR)
17+ raise Exception(msg)
18 return ca_rel
19
20 # Best guess match based on deb string provided

Subscribers

People subscribed via source and target branches