Merge lp:~gnuoy/charms/trusty/neutron-openvswitch/1421215 into lp:~openstack-charmers-archive/charms/trusty/neutron-openvswitch/next
- Trusty Tahr (14.04)
- 1421215
- Merge into next
Status: | Merged |
---|---|
Merged at revision: | 44 |
Proposed branch: | lp:~gnuoy/charms/trusty/neutron-openvswitch/1421215 |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/neutron-openvswitch/next |
Diff against target: |
252 lines (+70/-27) 10 files modified
hooks/charmhelpers/contrib/openstack/amulet/deployment.py (+5/-2) hooks/charmhelpers/contrib/python/packages.py (+2/-2) hooks/charmhelpers/core/fstab.py (+2/-2) hooks/charmhelpers/core/strutils.py (+38/-0) hooks/charmhelpers/core/sysctl.py (+2/-2) hooks/charmhelpers/core/unitdata.py (+1/-1) hooks/charmhelpers/fetch/archiveurl.py (+10/-10) hooks/charmhelpers/fetch/giturl.py (+1/-1) hooks/neutron_ovs_context.py (+5/-3) unit_tests/test_neutron_ovs_context.py (+4/-4) |
To merge this branch: | bzr merge lp:~gnuoy/charms/trusty/neutron-openvswitch/1421215 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Edward Hope-Morley | Approve | ||
Review via email: mp+249535@code.launchpad.net |
Commit message
Description of the change
uosci-testing-bot (uosci-testing-bot) wrote : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #1744 neutron-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #1895 neutron-
AMULET FAIL: amulet-test missing
AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.
Full amulet test output: http://
Build: http://
- 45. By Liam Young
-
Fix lint
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #1957 neutron-
LINT FAIL: lint-test failed
LINT Results (max last 2 lines):
hooks/
make: *** [lint] Error 1
Full lint test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #1747 neutron-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #1898 neutron-
AMULET FAIL: amulet-test missing
AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.
Full amulet test output: http://
Build: http://
- 46. By Liam Young
-
Try to fix lint error that osci is seeing although I cannot reproduce locally
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #1970 neutron-
LINT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #1760 neutron-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #1909 neutron-
AMULET FAIL: amulet-test missing
AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.
Full amulet test output: http://
Build: http://
Edward Hope-Morley (hopem) wrote : | # |
Lets start using common code for tasks like this -https:/
Edward Hope-Morley (hopem) : | # |
- 47. By Liam Young
-
Use charmhelper bool_from_string rather than local to_boolean
Preview Diff
1 | === modified file 'hooks/charmhelpers/contrib/openstack/amulet/deployment.py' |
2 | --- hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-01-26 09:42:44 +0000 |
3 | +++ hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2015-02-16 11:16:24 +0000 |
4 | @@ -71,16 +71,19 @@ |
5 | services.append(this_service) |
6 | use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph', |
7 | 'ceph-osd', 'ceph-radosgw'] |
8 | + # Openstack subordinate charms do not expose an origin option as that |
9 | + # is controlled by the principle |
10 | + ignore = ['neutron-openvswitch'] |
11 | |
12 | if self.openstack: |
13 | for svc in services: |
14 | - if svc['name'] not in use_source: |
15 | + if svc['name'] not in use_source + ignore: |
16 | config = {'openstack-origin': self.openstack} |
17 | self.d.configure(svc['name'], config) |
18 | |
19 | if self.source: |
20 | for svc in services: |
21 | - if svc['name'] in use_source: |
22 | + if svc['name'] in use_source and svc['name'] not in ignore: |
23 | config = {'source': self.source} |
24 | self.d.configure(svc['name'], config) |
25 | |
26 | |
27 | === modified file 'hooks/charmhelpers/contrib/python/packages.py' |
28 | --- hooks/charmhelpers/contrib/python/packages.py 2015-01-26 09:42:44 +0000 |
29 | +++ hooks/charmhelpers/contrib/python/packages.py 2015-02-16 11:16:24 +0000 |
30 | @@ -17,8 +17,6 @@ |
31 | # You should have received a copy of the GNU Lesser General Public License |
32 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
33 | |
34 | -__author__ = "Jorge Niedbalski <jorge.niedbalski@canonical.com>" |
35 | - |
36 | from charmhelpers.fetch import apt_install, apt_update |
37 | from charmhelpers.core.hookenv import log |
38 | |
39 | @@ -29,6 +27,8 @@ |
40 | apt_install('python-pip') |
41 | from pip import main as pip_execute |
42 | |
43 | +__author__ = "Jorge Niedbalski <jorge.niedbalski@canonical.com>" |
44 | + |
45 | |
46 | def parse_options(given, available): |
47 | """Given a set of options, check if available""" |
48 | |
49 | === modified file 'hooks/charmhelpers/core/fstab.py' |
50 | --- hooks/charmhelpers/core/fstab.py 2015-01-26 09:42:44 +0000 |
51 | +++ hooks/charmhelpers/core/fstab.py 2015-02-16 11:16:24 +0000 |
52 | @@ -17,11 +17,11 @@ |
53 | # You should have received a copy of the GNU Lesser General Public License |
54 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
55 | |
56 | -__author__ = 'Jorge Niedbalski R. <jorge.niedbalski@canonical.com>' |
57 | - |
58 | import io |
59 | import os |
60 | |
61 | +__author__ = 'Jorge Niedbalski R. <jorge.niedbalski@canonical.com>' |
62 | + |
63 | |
64 | class Fstab(io.FileIO): |
65 | """This class extends file in order to implement a file reader/writer |
66 | |
67 | === added file 'hooks/charmhelpers/core/strutils.py' |
68 | --- hooks/charmhelpers/core/strutils.py 1970-01-01 00:00:00 +0000 |
69 | +++ hooks/charmhelpers/core/strutils.py 2015-02-16 11:16:24 +0000 |
70 | @@ -0,0 +1,38 @@ |
71 | +#!/usr/bin/env python |
72 | +# -*- coding: utf-8 -*- |
73 | + |
74 | +# Copyright 2014-2015 Canonical Limited. |
75 | +# |
76 | +# This file is part of charm-helpers. |
77 | +# |
78 | +# charm-helpers is free software: you can redistribute it and/or modify |
79 | +# it under the terms of the GNU Lesser General Public License version 3 as |
80 | +# published by the Free Software Foundation. |
81 | +# |
82 | +# charm-helpers is distributed in the hope that it will be useful, |
83 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
84 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
85 | +# GNU Lesser General Public License for more details. |
86 | +# |
87 | +# You should have received a copy of the GNU Lesser General Public License |
88 | +# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
89 | + |
90 | + |
91 | +def bool_from_string(value): |
92 | + """Interpret string value as boolean. |
93 | + |
94 | + Returns True if value translates to True otherwise False. |
95 | + """ |
96 | + if isinstance(value, str): |
97 | + value = value.lower() |
98 | + else: |
99 | + msg = "Unable to interpret non-string value '%s' as boolean" % (value) |
100 | + raise ValueError(msg) |
101 | + |
102 | + if value in ['y', 'yes', 'true', 't']: |
103 | + return True |
104 | + elif value in ['n', 'no', 'false', 'f']: |
105 | + return False |
106 | + |
107 | + msg = "Unable to interpret string value '%s' as boolean" % (value) |
108 | + raise ValueError(msg) |
109 | |
110 | === modified file 'hooks/charmhelpers/core/sysctl.py' |
111 | --- hooks/charmhelpers/core/sysctl.py 2015-02-11 12:37:28 +0000 |
112 | +++ hooks/charmhelpers/core/sysctl.py 2015-02-16 11:16:24 +0000 |
113 | @@ -17,8 +17,6 @@ |
114 | # You should have received a copy of the GNU Lesser General Public License |
115 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
116 | |
117 | -__author__ = 'Jorge Niedbalski R. <jorge.niedbalski@canonical.com>' |
118 | - |
119 | import yaml |
120 | |
121 | from subprocess import check_call |
122 | @@ -29,6 +27,8 @@ |
123 | ERROR, |
124 | ) |
125 | |
126 | +__author__ = 'Jorge Niedbalski R. <jorge.niedbalski@canonical.com>' |
127 | + |
128 | |
129 | def create(sysctl_dict, sysctl_file): |
130 | """Creates a sysctl.conf file from a YAML associative array |
131 | |
132 | === modified file 'hooks/charmhelpers/core/unitdata.py' |
133 | --- hooks/charmhelpers/core/unitdata.py 2015-02-11 12:37:28 +0000 |
134 | +++ hooks/charmhelpers/core/unitdata.py 2015-02-16 11:16:24 +0000 |
135 | @@ -435,7 +435,7 @@ |
136 | os.path.join(charm_dir, 'revision')).read().strip() |
137 | charm_rev = charm_rev or '0' |
138 | revs = self.kv.get('charm_revisions', []) |
139 | - if not charm_rev in revs: |
140 | + if charm_rev not in revs: |
141 | revs.append(charm_rev.strip() or '0') |
142 | self.kv.set('charm_revisions', revs) |
143 | |
144 | |
145 | === modified file 'hooks/charmhelpers/fetch/archiveurl.py' |
146 | --- hooks/charmhelpers/fetch/archiveurl.py 2015-01-26 09:42:44 +0000 |
147 | +++ hooks/charmhelpers/fetch/archiveurl.py 2015-02-16 11:16:24 +0000 |
148 | @@ -18,6 +18,16 @@ |
149 | import hashlib |
150 | import re |
151 | |
152 | +from charmhelpers.fetch import ( |
153 | + BaseFetchHandler, |
154 | + UnhandledSource |
155 | +) |
156 | +from charmhelpers.payload.archive import ( |
157 | + get_archive_handler, |
158 | + extract, |
159 | +) |
160 | +from charmhelpers.core.host import mkdir, check_hash |
161 | + |
162 | import six |
163 | if six.PY3: |
164 | from urllib.request import ( |
165 | @@ -35,16 +45,6 @@ |
166 | ) |
167 | from urlparse import urlparse, urlunparse, parse_qs |
168 | |
169 | -from charmhelpers.fetch import ( |
170 | - BaseFetchHandler, |
171 | - UnhandledSource |
172 | -) |
173 | -from charmhelpers.payload.archive import ( |
174 | - get_archive_handler, |
175 | - extract, |
176 | -) |
177 | -from charmhelpers.core.host import mkdir, check_hash |
178 | - |
179 | |
180 | def splituser(host): |
181 | '''urllib.splituser(), but six's support of this seems broken''' |
182 | |
183 | === modified file 'hooks/charmhelpers/fetch/giturl.py' |
184 | --- hooks/charmhelpers/fetch/giturl.py 2015-01-26 09:42:44 +0000 |
185 | +++ hooks/charmhelpers/fetch/giturl.py 2015-02-16 11:16:24 +0000 |
186 | @@ -32,7 +32,7 @@ |
187 | apt_install("python-git") |
188 | from git import Repo |
189 | |
190 | -from git.exc import GitCommandError |
191 | +from git.exc import GitCommandError # noqa E402 |
192 | |
193 | |
194 | class GitUrlFetchHandler(BaseFetchHandler): |
195 | |
196 | === modified file 'hooks/neutron_ovs_context.py' |
197 | --- hooks/neutron_ovs_context.py 2014-10-10 09:55:20 +0000 |
198 | +++ hooks/neutron_ovs_context.py 2015-02-16 11:16:24 +0000 |
199 | @@ -6,12 +6,12 @@ |
200 | unit_get, |
201 | ) |
202 | from charmhelpers.core.host import list_nics, get_nic_hwaddr |
203 | +from charmhelpers.core.strutils import bool_from_string |
204 | from charmhelpers.contrib.openstack import context |
205 | from charmhelpers.core.host import service_running, service_start |
206 | from charmhelpers.contrib.network.ovs import add_bridge, add_bridge_port |
207 | from charmhelpers.contrib.openstack.utils import get_host_ip |
208 | from charmhelpers.contrib.network.ip import get_address_in_network |
209 | - |
210 | import re |
211 | |
212 | OVS_BRIDGE = 'br-int' |
213 | @@ -33,9 +33,11 @@ |
214 | if 'l2-population' not in rdata: |
215 | continue |
216 | neutron_settings = { |
217 | - 'l2_population': rdata['l2-population'], |
218 | - 'neutron_security_groups': rdata['neutron-security-groups'], |
219 | + 'l2_population': bool_from_string(rdata['l2-population']), |
220 | 'overlay_network_type': rdata['overlay-network-type'], |
221 | + 'neutron_security_groups': bool_from_string( |
222 | + rdata['neutron-security-groups'] |
223 | + ), |
224 | } |
225 | # Override with configuration if set to true |
226 | if config('disable-security-groups'): |
227 | |
228 | === modified file 'unit_tests/test_neutron_ovs_context.py' |
229 | --- unit_tests/test_neutron_ovs_context.py 2014-10-10 09:55:20 +0000 |
230 | +++ unit_tests/test_neutron_ovs_context.py 2015-02-16 11:16:24 +0000 |
231 | @@ -88,8 +88,8 @@ |
232 | _is_clus.return_value = False |
233 | self.related_units.return_value = ['unit1'] |
234 | self.relation_ids.return_value = ['rid2'] |
235 | - self.test_relation.set({'neutron-security-groups': True, |
236 | - 'l2-population': True, |
237 | + self.test_relation.set({'neutron-security-groups': 'True', |
238 | + 'l2-population': 'True', |
239 | 'overlay-network-type': 'gre', |
240 | }) |
241 | self.get_host_ip.return_value = '127.0.0.15' |
242 | @@ -141,8 +141,8 @@ |
243 | self.test_config.set('disable-security-groups', True) |
244 | self.related_units.return_value = ['unit1'] |
245 | self.relation_ids.return_value = ['rid2'] |
246 | - self.test_relation.set({'neutron-security-groups': True, |
247 | - 'l2-population': True, |
248 | + self.test_relation.set({'neutron-security-groups': 'True', |
249 | + 'l2-population': 'True', |
250 | 'overlay-network-type': 'gre', |
251 | }) |
252 | self.get_host_ip.return_value = '127.0.0.15' |
charm_lint_check #1954 neutron- openvswitch- next for gnuoy mp249535
LINT FAIL: lint-test failed
LINT Results (max last 2 lines): neutron_ ovs_context. py:43:80: E501 line too long (88 > 79 characters)
hooks/
make: *** [lint] Error 1
Full lint test output: http:// paste.ubuntu. com/10190756/ 10.245. 162.77: 8080/job/ charm_lint_ check/1954/
Build: http://