~openstack-charmers-archive/charms/trusty/nova-compute/trunk

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/utils.py

  • Committer: Liam Young
  • Date: 2016-01-08 13:21:27 UTC
  • mfrom: (144.1.1 nova-compute)
  • Revision ID: liam.young@canonical.com-20160108132127-cxqx0055u1sr0953
[james-page, r=gnuoy] Charmhelper sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
# >= Liberty version->codename mapping
128
128
PACKAGE_CODENAMES = {
129
129
    'nova-common': OrderedDict([
130
 
        ('12.0.0', 'liberty'),
 
130
        ('12.0', 'liberty'),
131
131
    ]),
132
132
    'neutron-common': OrderedDict([
133
 
        ('7.0.0', 'liberty'),
 
133
        ('7.0', 'liberty'),
134
134
    ]),
135
135
    'cinder-common': OrderedDict([
136
 
        ('7.0.0', 'liberty'),
 
136
        ('7.0', 'liberty'),
137
137
    ]),
138
138
    'keystone': OrderedDict([
139
 
        ('8.0.0', 'liberty'),
 
139
        ('8.0', 'liberty'),
140
140
    ]),
141
141
    'horizon-common': OrderedDict([
142
 
        ('8.0.0', 'liberty'),
 
142
        ('8.0', 'liberty'),
143
143
    ]),
144
144
    'ceilometer-common': OrderedDict([
145
 
        ('5.0.0', 'liberty'),
 
145
        ('5.0', 'liberty'),
146
146
    ]),
147
147
    'heat-common': OrderedDict([
148
 
        ('5.0.0', 'liberty'),
 
148
        ('5.0', 'liberty'),
149
149
    ]),
150
150
    'glance-common': OrderedDict([
151
 
        ('11.0.0', 'liberty'),
 
151
        ('11.0', 'liberty'),
152
152
    ]),
153
153
    'openstack-dashboard': OrderedDict([
154
 
        ('8.0.0', 'liberty'),
 
154
        ('8.0', 'liberty'),
155
155
    ]),
156
156
}
157
157
 
238
238
        error_out(e)
239
239
 
240
240
    vers = apt.upstream_version(pkg.current_ver.ver_str)
241
 
    match = re.match('^(\d+)\.(\d+)\.(\d+)', vers)
 
241
    if 'swift' in pkg.name:
 
242
        # Fully x.y.z match for swift versions
 
243
        match = re.match('^(\d+)\.(\d+)\.(\d+)', vers)
 
244
    else:
 
245
        # x.y match only for 20XX.X
 
246
        # and ignore patch level for other packages
 
247
        match = re.match('^(\d+)\.(\d+)', vers)
 
248
 
242
249
    if match:
243
250
        vers = match.group(0)
244
251
 
250
257
        # < Liberty co-ordinated project versions
251
258
        try:
252
259
            if 'swift' in pkg.name:
253
 
                swift_vers = vers[:5]
254
 
                if swift_vers not in SWIFT_CODENAMES:
255
 
                    # Deal with 1.10.0 upward
256
 
                    swift_vers = vers[:6]
257
 
                return SWIFT_CODENAMES[swift_vers]
 
260
                return SWIFT_CODENAMES[vers]
258
261
            else:
259
 
                vers = vers[:6]
260
262
                return OPENSTACK_CODENAMES[vers]
261
263
        except KeyError:
262
264
            if not fatal: