Merge lp:~james-page/charm-helpers/lp1531102 into lp:charm-helpers

Proposed by James Page on 2016-01-05
Status: Merged
Merged at revision: 512
Proposed branch: lp:~james-page/charm-helpers/lp1531102
Merge into: lp:charm-helpers
Diff against target: 141 lines (+41/-36)
2 files modified
charmhelpers/contrib/openstack/utils.py (+27/-25)
tests/contrib/openstack/test_openstack_utils.py (+14/-11)
To merge this branch: bzr merge lp:~james-page/charm-helpers/lp1531102
Reviewer Review Type Date Requested Status
Liam Young 2016-01-05 Approve on 2016-01-05
Review via email: mp+281589@code.launchpad.net

Description of the change

Update >= liberty version detection to deal with patch release, tidy swift version code and fixup unit tests.

To post a comment you must log in.
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-12-14 14:32:10 +0000
3+++ charmhelpers/contrib/openstack/utils.py 2016-01-05 09:22:01 +0000
4@@ -131,40 +131,40 @@
5 # >= Liberty version->codename mapping
6 PACKAGE_CODENAMES = {
7 'nova-common': OrderedDict([
8- ('12.0.0', 'liberty'),
9- ('13.0.0', 'mitaka'),
10+ ('12.0', 'liberty'),
11+ ('13.0', 'mitaka'),
12 ]),
13 'neutron-common': OrderedDict([
14- ('7.0.0', 'liberty'),
15- ('8.0.0', 'mitaka'),
16+ ('7.0', 'liberty'),
17+ ('8.0', 'mitaka'),
18 ]),
19 'cinder-common': OrderedDict([
20- ('7.0.0', 'liberty'),
21- ('8.0.0', 'mitaka'),
22+ ('7.0', 'liberty'),
23+ ('8.0', 'mitaka'),
24 ]),
25 'keystone': OrderedDict([
26- ('8.0.0', 'liberty'),
27- ('9.0.0', 'mitaka'),
28+ ('8.0', 'liberty'),
29+ ('9.0', 'mitaka'),
30 ]),
31 'horizon-common': OrderedDict([
32- ('8.0.0', 'liberty'),
33- ('9.0.0', 'mitaka'),
34+ ('8.0', 'liberty'),
35+ ('9.0', 'mitaka'),
36 ]),
37 'ceilometer-common': OrderedDict([
38- ('5.0.0', 'liberty'),
39- ('6.0.0', 'mitaka'),
40+ ('5.0', 'liberty'),
41+ ('6.0', 'mitaka'),
42 ]),
43 'heat-common': OrderedDict([
44- ('5.0.0', 'liberty'),
45- ('6.0.0', 'mitaka'),
46+ ('5.0', 'liberty'),
47+ ('6.0', 'mitaka'),
48 ]),
49 'glance-common': OrderedDict([
50- ('11.0.0', 'liberty'),
51- ('12.0.0', 'mitaka'),
52+ ('11.0', 'liberty'),
53+ ('12.0', 'mitaka'),
54 ]),
55 'openstack-dashboard': OrderedDict([
56- ('8.0.0', 'liberty'),
57- ('9.0.0', 'mitaka'),
58+ ('8.0', 'liberty'),
59+ ('9.0', 'mitaka'),
60 ]),
61 }
62
63@@ -251,7 +251,14 @@
64 error_out(e)
65
66 vers = apt.upstream_version(pkg.current_ver.ver_str)
67- match = re.match('^(\d+)\.(\d+)\.(\d+)', vers)
68+ if 'swift' in pkg.name:
69+ # Fully x.y.z match for swift versions
70+ match = re.match('^(\d+)\.(\d+)\.(\d+)', vers)
71+ else:
72+ # x.y match only for 20XX.X
73+ # and ignore patch level for other packages
74+ match = re.match('^(\d+)\.(\d+)', vers)
75+
76 if match:
77 vers = match.group(0)
78
79@@ -263,13 +270,8 @@
80 # < Liberty co-ordinated project versions
81 try:
82 if 'swift' in pkg.name:
83- swift_vers = vers[:5]
84- if swift_vers not in SWIFT_CODENAMES:
85- # Deal with 1.10.0 upward
86- swift_vers = vers[:6]
87- return SWIFT_CODENAMES[swift_vers]
88+ return SWIFT_CODENAMES[vers]
89 else:
90- vers = vers[:6]
91 return OPENSTACK_CODENAMES[vers]
92 except KeyError:
93 if not fatal:
94
95=== modified file 'tests/contrib/openstack/test_openstack_utils.py'
96--- tests/contrib/openstack/test_openstack_utils.py 2015-12-14 14:32:10 +0000
97+++ tests/contrib/openstack/test_openstack_utils.py 2016-01-05 09:22:01 +0000
98@@ -26,11 +26,13 @@
99 }
100
101 FAKE_REPO = {
102+ # liberty patch release
103 'neutron-common': {
104- 'pkg_vers': '2:7.0.0-0ubuntu1',
105+ 'pkg_vers': '2:7.0.1-0ubuntu1',
106 'os_release': 'liberty',
107 'os_version': '2015.2'
108 },
109+ # liberty release version
110 'nova-common': {
111 'pkg_vers': '2:12.0.0~b1-0ubuntu1',
112 'os_release': 'liberty',
113@@ -51,17 +53,18 @@
114 'os_release': 'grizzly',
115 'os_version': '2013.1'
116 },
117- 'swift-proxy': {
118- 'pkg_vers': '1.7.7-0ubuntu1',
119+ # Exercise swift version detection
120+ 'swift-storage': {
121+ 'pkg_vers': '1.8.0-0ubuntu1',
122 'os_release': 'grizzly',
123- 'os_version': '1.7.7'
124- },
125- 'swift-proxy': {
126- 'pkg_vers': '1.9.0-0ubuntu1',
127- 'os_release': 'havana',
128- 'os_version': '1.9.0'
129- },
130- 'swift-proxy': {
131+ 'os_version': '1.8.0'
132+ },
133+ 'swift-proxy': {
134+ 'pkg_vers': '1.13.1-0ubuntu1',
135+ 'os_release': 'icehouse',
136+ 'os_version': '1.13.1'
137+ },
138+ 'swift-common': {
139 'pkg_vers': '1.10.0~rc1-0ubuntu1',
140 'os_release': 'havana',
141 'os_version': '1.10.0'

Subscribers

People subscribed via source and target branches