Merge lp:~james-page/charm-helpers/fixup-detection into lp:charm-helpers

Proposed by James Page
Status: Merged
Merged at revision: 438
Proposed branch: lp:~james-page/charm-helpers/fixup-detection
Merge into: lp:charm-helpers
Diff against target: 34 lines (+4/-2)
2 files modified
charmhelpers/contrib/openstack/utils.py (+3/-1)
tests/contrib/openstack/test_openstack_utils.py (+1/-1)
To merge this branch: bzr merge lp:~james-page/charm-helpers/fixup-detection
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+270016@code.launchpad.net

Description of the change

Fixup two issues:

1) make regex for >= liberty greedy, matching multiple digits for versions, and update associated tests to ensure that this is exercised.

2) fixup non fatal detection scenario for older version matching code.

To post a comment you must log in.
Revision history for this message
Liam Young (gnuoy) wrote :

Approve

review: Approve

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 2015-08-28 09:08:41 +0000
3+++ charmhelpers/contrib/openstack/utils.py 2015-09-03 08:43:18 +0000
4@@ -227,7 +227,7 @@
5 error_out(e)
6
7 vers = apt.upstream_version(pkg.current_ver.ver_str)
8- match = re.match('^(\d)\.(\d)\.(\d)', vers)
9+ match = re.match('^(\d+)\.(\d+)\.(\d+)', vers)
10 if match:
11 vers = match.group(0)
12
13@@ -248,6 +248,8 @@
14 vers = vers[:6]
15 return OPENSTACK_CODENAMES[vers]
16 except KeyError:
17+ if not fatal:
18+ return None
19 e = 'Could not determine OpenStack codename for version %s' % vers
20 error_out(e)
21
22
23=== modified file 'tests/contrib/openstack/test_openstack_utils.py'
24--- tests/contrib/openstack/test_openstack_utils.py 2015-08-28 09:08:41 +0000
25+++ tests/contrib/openstack/test_openstack_utils.py 2015-09-03 08:43:18 +0000
26@@ -36,7 +36,7 @@
27 'os_release': 'liberty',
28 'os_version': '2015.2'
29 },
30- 'nova-common': {
31+ 'nova': {
32 'pkg_vers': '2012.2.3-0ubuntu2.1',
33 'os_release': 'folsom',
34 'os_version': '2012.2'

Subscribers

People subscribed via source and target branches