Merge lp:~james-page/charms/trusty/neutron-api/lp1531102 into lp:~openstack-charmers-archive/charms/trusty/neutron-api/next

Proposed by James Page
Status: Merged
Merged at revision: 161
Proposed branch: lp:~james-page/charms/trusty/neutron-api/lp1531102
Merge into: lp:~openstack-charmers-archive/charms/trusty/neutron-api/next
Diff against target: 166 lines (+95/-25)
2 files modified
hooks/charmhelpers/contrib/openstack/utils.py (+27/-25)
hooks/charmhelpers/core/kernel.py (+68/-0)
To merge this branch: bzr merge lp:~james-page/charms/trusty/neutron-api/lp1531102
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+281609@code.launchpad.net

Commit message

Resync helpers

Description of the change

Resync helpers

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #16586 neutron-api-next for james-page mp281609
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/16586/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #15489 neutron-api-next for james-page mp281609
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/15489/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8509 neutron-api-next for james-page mp281609
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8509/

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
=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
--- hooks/charmhelpers/contrib/openstack/utils.py 2016-01-04 21:28:17 +0000
+++ hooks/charmhelpers/contrib/openstack/utils.py 2016-01-05 11:34:38 +0000
@@ -131,40 +131,40 @@
131# >= Liberty version->codename mapping131# >= Liberty version->codename mapping
132PACKAGE_CODENAMES = {132PACKAGE_CODENAMES = {
133 'nova-common': OrderedDict([133 'nova-common': OrderedDict([
134 ('12.0.0', 'liberty'),134 ('12.0', 'liberty'),
135 ('13.0.0', 'mitaka'),135 ('13.0', 'mitaka'),
136 ]),136 ]),
137 'neutron-common': OrderedDict([137 'neutron-common': OrderedDict([
138 ('7.0.0', 'liberty'),138 ('7.0', 'liberty'),
139 ('8.0.0', 'mitaka'),139 ('8.0', 'mitaka'),
140 ]),140 ]),
141 'cinder-common': OrderedDict([141 'cinder-common': OrderedDict([
142 ('7.0.0', 'liberty'),142 ('7.0', 'liberty'),
143 ('8.0.0', 'mitaka'),143 ('8.0', 'mitaka'),
144 ]),144 ]),
145 'keystone': OrderedDict([145 'keystone': OrderedDict([
146 ('8.0.0', 'liberty'),146 ('8.0', 'liberty'),
147 ('9.0.0', 'mitaka'),147 ('9.0', 'mitaka'),
148 ]),148 ]),
149 'horizon-common': OrderedDict([149 'horizon-common': OrderedDict([
150 ('8.0.0', 'liberty'),150 ('8.0', 'liberty'),
151 ('9.0.0', 'mitaka'),151 ('9.0', 'mitaka'),
152 ]),152 ]),
153 'ceilometer-common': OrderedDict([153 'ceilometer-common': OrderedDict([
154 ('5.0.0', 'liberty'),154 ('5.0', 'liberty'),
155 ('6.0.0', 'mitaka'),155 ('6.0', 'mitaka'),
156 ]),156 ]),
157 'heat-common': OrderedDict([157 'heat-common': OrderedDict([
158 ('5.0.0', 'liberty'),158 ('5.0', 'liberty'),
159 ('6.0.0', 'mitaka'),159 ('6.0', 'mitaka'),
160 ]),160 ]),
161 'glance-common': OrderedDict([161 'glance-common': OrderedDict([
162 ('11.0.0', 'liberty'),162 ('11.0', 'liberty'),
163 ('12.0.0', 'mitaka'),163 ('12.0', 'mitaka'),
164 ]),164 ]),
165 'openstack-dashboard': OrderedDict([165 'openstack-dashboard': OrderedDict([
166 ('8.0.0', 'liberty'),166 ('8.0', 'liberty'),
167 ('9.0.0', 'mitaka'),167 ('9.0', 'mitaka'),
168 ]),168 ]),
169}169}
170170
@@ -251,7 +251,14 @@
251 error_out(e)251 error_out(e)
252252
253 vers = apt.upstream_version(pkg.current_ver.ver_str)253 vers = apt.upstream_version(pkg.current_ver.ver_str)
254 match = re.match('^(\d+)\.(\d+)\.(\d+)', vers)254 if 'swift' in pkg.name:
255 # Fully x.y.z match for swift versions
256 match = re.match('^(\d+)\.(\d+)\.(\d+)', vers)
257 else:
258 # x.y match only for 20XX.X
259 # and ignore patch level for other packages
260 match = re.match('^(\d+)\.(\d+)', vers)
261
255 if match:262 if match:
256 vers = match.group(0)263 vers = match.group(0)
257264
@@ -263,13 +270,8 @@
263 # < Liberty co-ordinated project versions270 # < Liberty co-ordinated project versions
264 try:271 try:
265 if 'swift' in pkg.name:272 if 'swift' in pkg.name:
266 swift_vers = vers[:5]273 return SWIFT_CODENAMES[vers]
267 if swift_vers not in SWIFT_CODENAMES:
268 # Deal with 1.10.0 upward
269 swift_vers = vers[:6]
270 return SWIFT_CODENAMES[swift_vers]
271 else:274 else:
272 vers = vers[:6]
273 return OPENSTACK_CODENAMES[vers]275 return OPENSTACK_CODENAMES[vers]
274 except KeyError:276 except KeyError:
275 if not fatal:277 if not fatal:
276278
=== added file 'hooks/charmhelpers/core/kernel.py'
--- hooks/charmhelpers/core/kernel.py 1970-01-01 00:00:00 +0000
+++ hooks/charmhelpers/core/kernel.py 2016-01-05 11:34:38 +0000
@@ -0,0 +1,68 @@
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4# Copyright 2014-2015 Canonical Limited.
5#
6# This file is part of charm-helpers.
7#
8# charm-helpers is free software: you can redistribute it and/or modify
9# it under the terms of the GNU Lesser General Public License version 3 as
10# published by the Free Software Foundation.
11#
12# charm-helpers is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Lesser General Public License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public License
18# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
19
20__author__ = "Jorge Niedbalski <jorge.niedbalski@canonical.com>"
21
22from charmhelpers.core.hookenv import (
23 log,
24 INFO
25)
26
27from subprocess import check_call, check_output
28import re
29
30
31def modprobe(module, persist=True):
32 """Load a kernel module and configure for auto-load on reboot."""
33 cmd = ['modprobe', module]
34
35 log('Loading kernel module %s' % module, level=INFO)
36
37 check_call(cmd)
38 if persist:
39 with open('/etc/modules', 'r+') as modules:
40 if module not in modules.read():
41 modules.write(module)
42
43
44def rmmod(module, force=False):
45 """Remove a module from the linux kernel"""
46 cmd = ['rmmod']
47 if force:
48 cmd.append('-f')
49 cmd.append(module)
50 log('Removing kernel module %s' % module, level=INFO)
51 return check_call(cmd)
52
53
54def lsmod():
55 """Shows what kernel modules are currently loaded"""
56 return check_output(['lsmod'],
57 universal_newlines=True)
58
59
60def is_module_loaded(module):
61 """Checks if a kernel module is already loaded"""
62 matches = re.findall('^%s[ ]+' % module, lsmod(), re.M)
63 return len(matches) > 0
64
65
66def update_initramfs(version='all'):
67 """Updates an initramfs image"""
68 return check_call(["update-initramfs", "-k", version, "-u"])

Subscribers

People subscribed via source and target branches