Merge lp:~james-page/charms/trusty/neutron-openvswitch/16.01-resync into lp:~openstack-charmers-archive/charms/trusty/neutron-openvswitch/next
- Trusty Tahr (14.04)
- 16.01-resync
- Merge into next
Status: | Merged |
---|---|
Merged at revision: | 105 |
Proposed branch: | lp:~james-page/charms/trusty/neutron-openvswitch/16.01-resync |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/neutron-openvswitch/next |
Diff against target: |
476 lines (+127/-67) 6 files modified
hooks/charmhelpers/contrib/openstack/amulet/deployment.py (+2/-1) hooks/charmhelpers/contrib/openstack/neutron.py (+14/-6) hooks/charmhelpers/contrib/openstack/utils.py (+63/-30) hooks/charmhelpers/core/host.py (+41/-26) hooks/charmhelpers/fetch/giturl.py (+5/-3) tests/charmhelpers/contrib/openstack/amulet/deployment.py (+2/-1) |
To merge this branch: | bzr merge lp:~james-page/charms/trusty/neutron-openvswitch/16.01-resync |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Liam Young (community) | Approve | ||
Review via email: mp+283933@code.launchpad.net |
Commit message
Description of the change
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #16948 neutron-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #18189 neutron-
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #9064 neutron-
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #9066 neutron-
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #9096 neutron-
AMULET OK: passed
Build: http://
Preview Diff
1 | === modified file 'hooks/charmhelpers/contrib/openstack/amulet/deployment.py' | |||
2 | --- hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2016-01-08 13:11:21 +0000 | |||
3 | +++ hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2016-01-26 12:00:08 +0000 | |||
4 | @@ -125,7 +125,8 @@ | |||
5 | 125 | 125 | ||
6 | 126 | # Charms which can not use openstack-origin, ie. many subordinates | 126 | # Charms which can not use openstack-origin, ie. many subordinates |
7 | 127 | no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe', | 127 | no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe', |
9 | 128 | 'openvswitch-odl', 'neutron-api-odl', 'odl-controller'] | 128 | 'openvswitch-odl', 'neutron-api-odl', 'odl-controller', |
10 | 129 | 'cinder-backup'] | ||
11 | 129 | 130 | ||
12 | 130 | if self.openstack: | 131 | if self.openstack: |
13 | 131 | for svc in services: | 132 | for svc in services: |
14 | 132 | 133 | ||
15 | === modified file 'hooks/charmhelpers/contrib/openstack/neutron.py' | |||
16 | --- hooks/charmhelpers/contrib/openstack/neutron.py 2016-01-08 13:11:21 +0000 | |||
17 | +++ hooks/charmhelpers/contrib/openstack/neutron.py 2016-01-26 12:00:08 +0000 | |||
18 | @@ -50,7 +50,7 @@ | |||
19 | 50 | if kernel_version() >= (3, 13): | 50 | if kernel_version() >= (3, 13): |
20 | 51 | return [] | 51 | return [] |
21 | 52 | else: | 52 | else: |
23 | 53 | return ['openvswitch-datapath-dkms'] | 53 | return [headers_package(), 'openvswitch-datapath-dkms'] |
24 | 54 | 54 | ||
25 | 55 | 55 | ||
26 | 56 | # legacy | 56 | # legacy |
27 | @@ -70,7 +70,7 @@ | |||
28 | 70 | relation_prefix='neutron', | 70 | relation_prefix='neutron', |
29 | 71 | ssl_dir=QUANTUM_CONF_DIR)], | 71 | ssl_dir=QUANTUM_CONF_DIR)], |
30 | 72 | 'services': ['quantum-plugin-openvswitch-agent'], | 72 | 'services': ['quantum-plugin-openvswitch-agent'], |
32 | 73 | 'packages': [[headers_package()] + determine_dkms_package(), | 73 | 'packages': [determine_dkms_package(), |
33 | 74 | ['quantum-plugin-openvswitch-agent']], | 74 | ['quantum-plugin-openvswitch-agent']], |
34 | 75 | 'server_packages': ['quantum-server', | 75 | 'server_packages': ['quantum-server', |
35 | 76 | 'quantum-plugin-openvswitch'], | 76 | 'quantum-plugin-openvswitch'], |
36 | @@ -111,7 +111,7 @@ | |||
37 | 111 | relation_prefix='neutron', | 111 | relation_prefix='neutron', |
38 | 112 | ssl_dir=NEUTRON_CONF_DIR)], | 112 | ssl_dir=NEUTRON_CONF_DIR)], |
39 | 113 | 'services': ['neutron-plugin-openvswitch-agent'], | 113 | 'services': ['neutron-plugin-openvswitch-agent'], |
41 | 114 | 'packages': [[headers_package()] + determine_dkms_package(), | 114 | 'packages': [determine_dkms_package(), |
42 | 115 | ['neutron-plugin-openvswitch-agent']], | 115 | ['neutron-plugin-openvswitch-agent']], |
43 | 116 | 'server_packages': ['neutron-server', | 116 | 'server_packages': ['neutron-server', |
44 | 117 | 'neutron-plugin-openvswitch'], | 117 | 'neutron-plugin-openvswitch'], |
45 | @@ -155,7 +155,7 @@ | |||
46 | 155 | relation_prefix='neutron', | 155 | relation_prefix='neutron', |
47 | 156 | ssl_dir=NEUTRON_CONF_DIR)], | 156 | ssl_dir=NEUTRON_CONF_DIR)], |
48 | 157 | 'services': [], | 157 | 'services': [], |
50 | 158 | 'packages': [[headers_package()] + determine_dkms_package(), | 158 | 'packages': [determine_dkms_package(), |
51 | 159 | ['neutron-plugin-cisco']], | 159 | ['neutron-plugin-cisco']], |
52 | 160 | 'server_packages': ['neutron-server', | 160 | 'server_packages': ['neutron-server', |
53 | 161 | 'neutron-plugin-cisco'], | 161 | 'neutron-plugin-cisco'], |
54 | @@ -174,7 +174,7 @@ | |||
55 | 174 | 'neutron-dhcp-agent', | 174 | 'neutron-dhcp-agent', |
56 | 175 | 'nova-api-metadata', | 175 | 'nova-api-metadata', |
57 | 176 | 'etcd'], | 176 | 'etcd'], |
59 | 177 | 'packages': [[headers_package()] + determine_dkms_package(), | 177 | 'packages': [determine_dkms_package(), |
60 | 178 | ['calico-compute', | 178 | ['calico-compute', |
61 | 179 | 'bird', | 179 | 'bird', |
62 | 180 | 'neutron-dhcp-agent', | 180 | 'neutron-dhcp-agent', |
63 | @@ -219,7 +219,7 @@ | |||
64 | 219 | relation_prefix='neutron', | 219 | relation_prefix='neutron', |
65 | 220 | ssl_dir=NEUTRON_CONF_DIR)], | 220 | ssl_dir=NEUTRON_CONF_DIR)], |
66 | 221 | 'services': [], | 221 | 'services': [], |
68 | 222 | 'packages': [[headers_package()] + determine_dkms_package()], | 222 | 'packages': [determine_dkms_package()], |
69 | 223 | 'server_packages': ['neutron-server', | 223 | 'server_packages': ['neutron-server', |
70 | 224 | 'python-neutron-plugin-midonet'], | 224 | 'python-neutron-plugin-midonet'], |
71 | 225 | 'server_services': ['neutron-server'] | 225 | 'server_services': ['neutron-server'] |
72 | @@ -233,6 +233,14 @@ | |||
73 | 233 | 'neutron-plugin-ml2'] | 233 | 'neutron-plugin-ml2'] |
74 | 234 | # NOTE: patch in vmware renames nvp->nsx for icehouse onwards | 234 | # NOTE: patch in vmware renames nvp->nsx for icehouse onwards |
75 | 235 | plugins['nvp'] = plugins['nsx'] | 235 | plugins['nvp'] = plugins['nsx'] |
76 | 236 | if release >= 'kilo': | ||
77 | 237 | plugins['midonet']['driver'] = ( | ||
78 | 238 | 'neutron.plugins.midonet.plugin.MidonetPluginV2') | ||
79 | 239 | if release >= 'liberty': | ||
80 | 240 | midonet_origin = config('midonet-origin') | ||
81 | 241 | if midonet_origin is not None and midonet_origin[4:5] == '1': | ||
82 | 242 | plugins['midonet']['driver'] = ( | ||
83 | 243 | 'midonet.neutron.plugin_v1.MidonetPluginV2') | ||
84 | 236 | return plugins | 244 | return plugins |
85 | 237 | 245 | ||
86 | 238 | 246 | ||
87 | 239 | 247 | ||
88 | === modified file 'hooks/charmhelpers/contrib/openstack/utils.py' | |||
89 | --- hooks/charmhelpers/contrib/openstack/utils.py 2016-01-08 21:04:45 +0000 | |||
90 | +++ hooks/charmhelpers/contrib/openstack/utils.py 2016-01-26 12:00:08 +0000 | |||
91 | @@ -103,29 +103,28 @@ | |||
92 | 103 | ('2016.1', 'mitaka'), | 103 | ('2016.1', 'mitaka'), |
93 | 104 | ]) | 104 | ]) |
94 | 105 | 105 | ||
96 | 106 | # The ugly duckling | 106 | # The ugly duckling - must list releases oldest to newest |
97 | 107 | SWIFT_CODENAMES = OrderedDict([ | 107 | SWIFT_CODENAMES = OrderedDict([ |
119 | 108 | ('1.4.3', 'diablo'), | 108 | ('diablo', |
120 | 109 | ('1.4.8', 'essex'), | 109 | ['1.4.3']), |
121 | 110 | ('1.7.4', 'folsom'), | 110 | ('essex', |
122 | 111 | ('1.8.0', 'grizzly'), | 111 | ['1.4.8']), |
123 | 112 | ('1.7.7', 'grizzly'), | 112 | ('folsom', |
124 | 113 | ('1.7.6', 'grizzly'), | 113 | ['1.7.4']), |
125 | 114 | ('1.10.0', 'havana'), | 114 | ('grizzly', |
126 | 115 | ('1.9.1', 'havana'), | 115 | ['1.7.6', '1.7.7', '1.8.0']), |
127 | 116 | ('1.9.0', 'havana'), | 116 | ('havana', |
128 | 117 | ('1.13.1', 'icehouse'), | 117 | ['1.9.0', '1.9.1', '1.10.0']), |
129 | 118 | ('1.13.0', 'icehouse'), | 118 | ('icehouse', |
130 | 119 | ('1.12.0', 'icehouse'), | 119 | ['1.11.0', '1.12.0', '1.13.0', '1.13.1']), |
131 | 120 | ('1.11.0', 'icehouse'), | 120 | ('juno', |
132 | 121 | ('2.0.0', 'juno'), | 121 | ['2.0.0', '2.1.0', '2.2.0']), |
133 | 122 | ('2.1.0', 'juno'), | 122 | ('kilo', |
134 | 123 | ('2.2.0', 'juno'), | 123 | ['2.2.1', '2.2.2']), |
135 | 124 | ('2.2.1', 'kilo'), | 124 | ('liberty', |
136 | 125 | ('2.2.2', 'kilo'), | 125 | ['2.3.0', '2.4.0', '2.5.0']), |
137 | 126 | ('2.3.0', 'liberty'), | 126 | ('mitaka', |
138 | 127 | ('2.4.0', 'liberty'), | 127 | ['2.5.0']), |
118 | 128 | ('2.5.0', 'liberty'), | ||
139 | 129 | ]) | 128 | ]) |
140 | 130 | 129 | ||
141 | 131 | # >= Liberty version->codename mapping | 130 | # >= Liberty version->codename mapping |
142 | @@ -227,6 +226,33 @@ | |||
143 | 227 | error_out(e) | 226 | error_out(e) |
144 | 228 | 227 | ||
145 | 229 | 228 | ||
146 | 229 | def get_os_version_codename_swift(codename): | ||
147 | 230 | '''Determine OpenStack version number of swift from codename.''' | ||
148 | 231 | for k, v in six.iteritems(SWIFT_CODENAMES): | ||
149 | 232 | if k == codename: | ||
150 | 233 | return v[-1] | ||
151 | 234 | e = 'Could not derive swift version for '\ | ||
152 | 235 | 'codename: %s' % codename | ||
153 | 236 | error_out(e) | ||
154 | 237 | |||
155 | 238 | |||
156 | 239 | def get_swift_codename(version): | ||
157 | 240 | '''Determine OpenStack codename that corresponds to swift version.''' | ||
158 | 241 | codenames = [k for k, v in six.iteritems(SWIFT_CODENAMES) if version in v] | ||
159 | 242 | if len(codenames) > 1: | ||
160 | 243 | # If more than one release codename contains this version we determine | ||
161 | 244 | # the actual codename based on the highest available install source. | ||
162 | 245 | for codename in reversed(codenames): | ||
163 | 246 | releases = UBUNTU_OPENSTACK_RELEASE | ||
164 | 247 | release = [k for k, v in six.iteritems(releases) if codename in v] | ||
165 | 248 | ret = subprocess.check_output(['apt-cache', 'policy', 'swift']) | ||
166 | 249 | if codename in ret or release[0] in ret: | ||
167 | 250 | return codename | ||
168 | 251 | elif len(codenames) == 1: | ||
169 | 252 | return codenames[0] | ||
170 | 253 | return None | ||
171 | 254 | |||
172 | 255 | |||
173 | 230 | def get_os_codename_package(package, fatal=True): | 256 | def get_os_codename_package(package, fatal=True): |
174 | 231 | '''Derive OpenStack release codename from an installed package.''' | 257 | '''Derive OpenStack release codename from an installed package.''' |
175 | 232 | import apt_pkg as apt | 258 | import apt_pkg as apt |
176 | @@ -270,7 +296,7 @@ | |||
177 | 270 | # < Liberty co-ordinated project versions | 296 | # < Liberty co-ordinated project versions |
178 | 271 | try: | 297 | try: |
179 | 272 | if 'swift' in pkg.name: | 298 | if 'swift' in pkg.name: |
181 | 273 | return SWIFT_CODENAMES[vers] | 299 | return get_swift_codename(vers) |
182 | 274 | else: | 300 | else: |
183 | 275 | return OPENSTACK_CODENAMES[vers] | 301 | return OPENSTACK_CODENAMES[vers] |
184 | 276 | except KeyError: | 302 | except KeyError: |
185 | @@ -289,12 +315,14 @@ | |||
186 | 289 | 315 | ||
187 | 290 | if 'swift' in pkg: | 316 | if 'swift' in pkg: |
188 | 291 | vers_map = SWIFT_CODENAMES | 317 | vers_map = SWIFT_CODENAMES |
189 | 318 | for cname, version in six.iteritems(vers_map): | ||
190 | 319 | if cname == codename: | ||
191 | 320 | return version[-1] | ||
192 | 292 | else: | 321 | else: |
193 | 293 | vers_map = OPENSTACK_CODENAMES | 322 | vers_map = OPENSTACK_CODENAMES |
198 | 294 | 323 | for version, cname in six.iteritems(vers_map): | |
199 | 295 | for version, cname in six.iteritems(vers_map): | 324 | if cname == codename: |
200 | 296 | if cname == codename: | 325 | return version |
197 | 297 | return version | ||
201 | 298 | # e = "Could not determine OpenStack version for package: %s" % pkg | 326 | # e = "Could not determine OpenStack version for package: %s" % pkg |
202 | 299 | # error_out(e) | 327 | # error_out(e) |
203 | 300 | 328 | ||
204 | @@ -460,11 +488,16 @@ | |||
205 | 460 | cur_vers = get_os_version_package(package) | 488 | cur_vers = get_os_version_package(package) |
206 | 461 | if "swift" in package: | 489 | if "swift" in package: |
207 | 462 | codename = get_os_codename_install_source(src) | 490 | codename = get_os_codename_install_source(src) |
209 | 463 | available_vers = get_os_version_codename(codename, SWIFT_CODENAMES) | 491 | avail_vers = get_os_version_codename_swift(codename) |
210 | 464 | else: | 492 | else: |
212 | 465 | available_vers = get_os_version_install_source(src) | 493 | avail_vers = get_os_version_install_source(src) |
213 | 466 | apt.init() | 494 | apt.init() |
215 | 467 | return apt.version_compare(available_vers, cur_vers) == 1 | 495 | if "swift" in package: |
216 | 496 | major_cur_vers = cur_vers.split('.', 1)[0] | ||
217 | 497 | major_avail_vers = avail_vers.split('.', 1)[0] | ||
218 | 498 | major_diff = apt.version_compare(major_avail_vers, major_cur_vers) | ||
219 | 499 | return avail_vers > cur_vers and (major_diff == 1 or major_diff == 0) | ||
220 | 500 | return apt.version_compare(avail_vers, cur_vers) == 1 | ||
221 | 468 | 501 | ||
222 | 469 | 502 | ||
223 | 470 | def ensure_block_device(block_device): | 503 | def ensure_block_device(block_device): |
224 | 471 | 504 | ||
225 | === modified file 'hooks/charmhelpers/core/host.py' | |||
226 | --- hooks/charmhelpers/core/host.py 2016-01-08 21:04:45 +0000 | |||
227 | +++ hooks/charmhelpers/core/host.py 2016-01-26 12:00:08 +0000 | |||
228 | @@ -138,7 +138,8 @@ | |||
229 | 138 | except subprocess.CalledProcessError: | 138 | except subprocess.CalledProcessError: |
230 | 139 | return False | 139 | return False |
231 | 140 | else: | 140 | else: |
233 | 141 | if ("start/running" in output or "is running" in output): | 141 | if ("start/running" in output or "is running" in output or |
234 | 142 | "up and running" in output): | ||
235 | 142 | return True | 143 | return True |
236 | 143 | else: | 144 | else: |
237 | 144 | return False | 145 | return False |
238 | @@ -160,13 +161,13 @@ | |||
239 | 160 | 161 | ||
240 | 161 | 162 | ||
241 | 162 | def init_is_systemd(): | 163 | def init_is_systemd(): |
242 | 164 | """Return True if the host system uses systemd, False otherwise.""" | ||
243 | 163 | return os.path.isdir(SYSTEMD_SYSTEM) | 165 | return os.path.isdir(SYSTEMD_SYSTEM) |
244 | 164 | 166 | ||
245 | 165 | 167 | ||
246 | 166 | def adduser(username, password=None, shell='/bin/bash', system_user=False, | 168 | def adduser(username, password=None, shell='/bin/bash', system_user=False, |
247 | 167 | primary_group=None, secondary_groups=None): | 169 | primary_group=None, secondary_groups=None): |
250 | 168 | """ | 170 | """Add a user to the system. |
249 | 169 | Add a user to the system. | ||
251 | 170 | 171 | ||
252 | 171 | Will log but otherwise succeed if the user already exists. | 172 | Will log but otherwise succeed if the user already exists. |
253 | 172 | 173 | ||
254 | @@ -174,7 +175,7 @@ | |||
255 | 174 | :param str password: Password for user; if ``None``, create a system user | 175 | :param str password: Password for user; if ``None``, create a system user |
256 | 175 | :param str shell: The default shell for the user | 176 | :param str shell: The default shell for the user |
257 | 176 | :param bool system_user: Whether to create a login or system user | 177 | :param bool system_user: Whether to create a login or system user |
259 | 177 | :param str primary_group: Primary group for user; defaults to their username | 178 | :param str primary_group: Primary group for user; defaults to username |
260 | 178 | :param list secondary_groups: Optional list of additional groups | 179 | :param list secondary_groups: Optional list of additional groups |
261 | 179 | 180 | ||
262 | 180 | :returns: The password database entry struct, as returned by `pwd.getpwnam` | 181 | :returns: The password database entry struct, as returned by `pwd.getpwnam` |
263 | @@ -300,14 +301,12 @@ | |||
264 | 300 | 301 | ||
265 | 301 | 302 | ||
266 | 302 | def fstab_remove(mp): | 303 | def fstab_remove(mp): |
269 | 303 | """Remove the given mountpoint entry from /etc/fstab | 304 | """Remove the given mountpoint entry from /etc/fstab""" |
268 | 304 | """ | ||
270 | 305 | return Fstab.remove_by_mountpoint(mp) | 305 | return Fstab.remove_by_mountpoint(mp) |
271 | 306 | 306 | ||
272 | 307 | 307 | ||
273 | 308 | def fstab_add(dev, mp, fs, options=None): | 308 | def fstab_add(dev, mp, fs, options=None): |
276 | 309 | """Adds the given device entry to the /etc/fstab file | 309 | """Adds the given device entry to the /etc/fstab file""" |
275 | 310 | """ | ||
277 | 311 | return Fstab.add(dev, mp, fs, options=options) | 310 | return Fstab.add(dev, mp, fs, options=options) |
278 | 312 | 311 | ||
279 | 313 | 312 | ||
280 | @@ -363,8 +362,7 @@ | |||
281 | 363 | 362 | ||
282 | 364 | 363 | ||
283 | 365 | def file_hash(path, hash_type='md5'): | 364 | def file_hash(path, hash_type='md5'): |
286 | 366 | """ | 365 | """Generate a hash checksum of the contents of 'path' or None if not found. |
285 | 367 | Generate a hash checksum of the contents of 'path' or None if not found. | ||
287 | 368 | 366 | ||
288 | 369 | :param str hash_type: Any hash alrgorithm supported by :mod:`hashlib`, | 367 | :param str hash_type: Any hash alrgorithm supported by :mod:`hashlib`, |
289 | 370 | such as md5, sha1, sha256, sha512, etc. | 368 | such as md5, sha1, sha256, sha512, etc. |
290 | @@ -379,10 +377,9 @@ | |||
291 | 379 | 377 | ||
292 | 380 | 378 | ||
293 | 381 | def path_hash(path): | 379 | def path_hash(path): |
298 | 382 | """ | 380 | """Generate a hash checksum of all files matching 'path'. Standard |
299 | 383 | Generate a hash checksum of all files matching 'path'. Standard wildcards | 381 | wildcards like '*' and '?' are supported, see documentation for the 'glob' |
300 | 384 | like '*' and '?' are supported, see documentation for the 'glob' module for | 382 | module for more information. |
297 | 385 | more information. | ||
301 | 386 | 383 | ||
302 | 387 | :return: dict: A { filename: hash } dictionary for all matched files. | 384 | :return: dict: A { filename: hash } dictionary for all matched files. |
303 | 388 | Empty if none found. | 385 | Empty if none found. |
304 | @@ -394,8 +391,7 @@ | |||
305 | 394 | 391 | ||
306 | 395 | 392 | ||
307 | 396 | def check_hash(path, checksum, hash_type='md5'): | 393 | def check_hash(path, checksum, hash_type='md5'): |
310 | 397 | """ | 394 | """Validate a file using a cryptographic checksum. |
309 | 398 | Validate a file using a cryptographic checksum. | ||
311 | 399 | 395 | ||
312 | 400 | :param str checksum: Value of the checksum used to validate the file. | 396 | :param str checksum: Value of the checksum used to validate the file. |
313 | 401 | :param str hash_type: Hash algorithm used to generate `checksum`. | 397 | :param str hash_type: Hash algorithm used to generate `checksum`. |
314 | @@ -410,6 +406,7 @@ | |||
315 | 410 | 406 | ||
316 | 411 | 407 | ||
317 | 412 | class ChecksumError(ValueError): | 408 | class ChecksumError(ValueError): |
318 | 409 | """A class derived from Value error to indicate the checksum failed.""" | ||
319 | 413 | pass | 410 | pass |
320 | 414 | 411 | ||
321 | 415 | 412 | ||
322 | @@ -515,7 +512,7 @@ | |||
323 | 515 | 512 | ||
324 | 516 | 513 | ||
325 | 517 | def list_nics(nic_type=None): | 514 | def list_nics(nic_type=None): |
327 | 518 | '''Return a list of nics of given type(s)''' | 515 | """Return a list of nics of given type(s)""" |
328 | 519 | if isinstance(nic_type, six.string_types): | 516 | if isinstance(nic_type, six.string_types): |
329 | 520 | int_types = [nic_type] | 517 | int_types = [nic_type] |
330 | 521 | else: | 518 | else: |
331 | @@ -557,12 +554,13 @@ | |||
332 | 557 | 554 | ||
333 | 558 | 555 | ||
334 | 559 | def set_nic_mtu(nic, mtu): | 556 | def set_nic_mtu(nic, mtu): |
336 | 560 | '''Set MTU on a network interface''' | 557 | """Set the Maximum Transmission Unit (MTU) on a network interface.""" |
337 | 561 | cmd = ['ip', 'link', 'set', nic, 'mtu', mtu] | 558 | cmd = ['ip', 'link', 'set', nic, 'mtu', mtu] |
338 | 562 | subprocess.check_call(cmd) | 559 | subprocess.check_call(cmd) |
339 | 563 | 560 | ||
340 | 564 | 561 | ||
341 | 565 | def get_nic_mtu(nic): | 562 | def get_nic_mtu(nic): |
342 | 563 | """Return the Maximum Transmission Unit (MTU) for a network interface.""" | ||
343 | 566 | cmd = ['ip', 'addr', 'show', nic] | 564 | cmd = ['ip', 'addr', 'show', nic] |
344 | 567 | ip_output = subprocess.check_output(cmd).decode('UTF-8').split('\n') | 565 | ip_output = subprocess.check_output(cmd).decode('UTF-8').split('\n') |
345 | 568 | mtu = "" | 566 | mtu = "" |
346 | @@ -574,6 +572,7 @@ | |||
347 | 574 | 572 | ||
348 | 575 | 573 | ||
349 | 576 | def get_nic_hwaddr(nic): | 574 | def get_nic_hwaddr(nic): |
350 | 575 | """Return the Media Access Control (MAC) for a network interface.""" | ||
351 | 577 | cmd = ['ip', '-o', '-0', 'addr', 'show', nic] | 576 | cmd = ['ip', '-o', '-0', 'addr', 'show', nic] |
352 | 578 | ip_output = subprocess.check_output(cmd).decode('UTF-8') | 577 | ip_output = subprocess.check_output(cmd).decode('UTF-8') |
353 | 579 | hwaddr = "" | 578 | hwaddr = "" |
354 | @@ -584,7 +583,7 @@ | |||
355 | 584 | 583 | ||
356 | 585 | 584 | ||
357 | 586 | def cmp_pkgrevno(package, revno, pkgcache=None): | 585 | def cmp_pkgrevno(package, revno, pkgcache=None): |
359 | 587 | '''Compare supplied revno with the revno of the installed package | 586 | """Compare supplied revno with the revno of the installed package |
360 | 588 | 587 | ||
361 | 589 | * 1 => Installed revno is greater than supplied arg | 588 | * 1 => Installed revno is greater than supplied arg |
362 | 590 | * 0 => Installed revno is the same as supplied arg | 589 | * 0 => Installed revno is the same as supplied arg |
363 | @@ -593,7 +592,7 @@ | |||
364 | 593 | This function imports apt_cache function from charmhelpers.fetch if | 592 | This function imports apt_cache function from charmhelpers.fetch if |
365 | 594 | the pkgcache argument is None. Be sure to add charmhelpers.fetch if | 593 | the pkgcache argument is None. Be sure to add charmhelpers.fetch if |
366 | 595 | you call this function, or pass an apt_pkg.Cache() instance. | 594 | you call this function, or pass an apt_pkg.Cache() instance. |
368 | 596 | ''' | 595 | """ |
369 | 597 | import apt_pkg | 596 | import apt_pkg |
370 | 598 | if not pkgcache: | 597 | if not pkgcache: |
371 | 599 | from charmhelpers.fetch import apt_cache | 598 | from charmhelpers.fetch import apt_cache |
372 | @@ -603,19 +602,27 @@ | |||
373 | 603 | 602 | ||
374 | 604 | 603 | ||
375 | 605 | @contextmanager | 604 | @contextmanager |
377 | 606 | def chdir(d): | 605 | def chdir(directory): |
378 | 606 | """Change the current working directory to a different directory for a code | ||
379 | 607 | block and return the previous directory after the block exits. Useful to | ||
380 | 608 | run commands from a specificed directory. | ||
381 | 609 | |||
382 | 610 | :param str directory: The directory path to change to for this context. | ||
383 | 611 | """ | ||
384 | 607 | cur = os.getcwd() | 612 | cur = os.getcwd() |
385 | 608 | try: | 613 | try: |
387 | 609 | yield os.chdir(d) | 614 | yield os.chdir(directory) |
388 | 610 | finally: | 615 | finally: |
389 | 611 | os.chdir(cur) | 616 | os.chdir(cur) |
390 | 612 | 617 | ||
391 | 613 | 618 | ||
392 | 614 | def chownr(path, owner, group, follow_links=True, chowntopdir=False): | 619 | def chownr(path, owner, group, follow_links=True, chowntopdir=False): |
395 | 615 | """ | 620 | """Recursively change user and group ownership of files and directories |
394 | 616 | Recursively change user and group ownership of files and directories | ||
396 | 617 | in given path. Doesn't chown path itself by default, only its children. | 621 | in given path. Doesn't chown path itself by default, only its children. |
397 | 618 | 622 | ||
398 | 623 | :param str path: The string path to start changing ownership. | ||
399 | 624 | :param str owner: The owner string to use when looking up the uid. | ||
400 | 625 | :param str group: The group string to use when looking up the gid. | ||
401 | 619 | :param bool follow_links: Also Chown links if True | 626 | :param bool follow_links: Also Chown links if True |
402 | 620 | :param bool chowntopdir: Also chown path itself if True | 627 | :param bool chowntopdir: Also chown path itself if True |
403 | 621 | """ | 628 | """ |
404 | @@ -639,15 +646,23 @@ | |||
405 | 639 | 646 | ||
406 | 640 | 647 | ||
407 | 641 | def lchownr(path, owner, group): | 648 | def lchownr(path, owner, group): |
408 | 649 | """Recursively change user and group ownership of files and directories | ||
409 | 650 | in a given path, not following symbolic links. See the documentation for | ||
410 | 651 | 'os.lchown' for more information. | ||
411 | 652 | |||
412 | 653 | :param str path: The string path to start changing ownership. | ||
413 | 654 | :param str owner: The owner string to use when looking up the uid. | ||
414 | 655 | :param str group: The group string to use when looking up the gid. | ||
415 | 656 | """ | ||
416 | 642 | chownr(path, owner, group, follow_links=False) | 657 | chownr(path, owner, group, follow_links=False) |
417 | 643 | 658 | ||
418 | 644 | 659 | ||
419 | 645 | def get_total_ram(): | 660 | def get_total_ram(): |
421 | 646 | '''The total amount of system RAM in bytes. | 661 | """The total amount of system RAM in bytes. |
422 | 647 | 662 | ||
423 | 648 | This is what is reported by the OS, and may be overcommitted when | 663 | This is what is reported by the OS, and may be overcommitted when |
424 | 649 | there are multiple containers hosted on the same machine. | 664 | there are multiple containers hosted on the same machine. |
426 | 650 | ''' | 665 | """ |
427 | 651 | with open('/proc/meminfo', 'r') as f: | 666 | with open('/proc/meminfo', 'r') as f: |
428 | 652 | for line in f.readlines(): | 667 | for line in f.readlines(): |
429 | 653 | if line: | 668 | if line: |
430 | 654 | 669 | ||
431 | === modified file 'hooks/charmhelpers/fetch/giturl.py' | |||
432 | --- hooks/charmhelpers/fetch/giturl.py 2016-01-08 21:04:45 +0000 | |||
433 | +++ hooks/charmhelpers/fetch/giturl.py 2016-01-26 12:00:08 +0000 | |||
434 | @@ -15,7 +15,7 @@ | |||
435 | 15 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. | 15 | # along with charm-helpers. If not, see <http://www.gnu.org/licenses/>. |
436 | 16 | 16 | ||
437 | 17 | import os | 17 | import os |
439 | 18 | from subprocess import check_call | 18 | from subprocess import check_call, CalledProcessError |
440 | 19 | from charmhelpers.fetch import ( | 19 | from charmhelpers.fetch import ( |
441 | 20 | BaseFetchHandler, | 20 | BaseFetchHandler, |
442 | 21 | UnhandledSource, | 21 | UnhandledSource, |
443 | @@ -49,8 +49,8 @@ | |||
444 | 49 | cmd = ['git', '-C', dest, 'pull', source, branch] | 49 | cmd = ['git', '-C', dest, 'pull', source, branch] |
445 | 50 | else: | 50 | else: |
446 | 51 | cmd = ['git', 'clone', source, dest, '--branch', branch] | 51 | cmd = ['git', 'clone', source, dest, '--branch', branch] |
449 | 52 | if depth: | 52 | if depth: |
450 | 53 | cmd.extend(['--depth', depth]) | 53 | cmd.extend(['--depth', depth]) |
451 | 54 | check_call(cmd) | 54 | check_call(cmd) |
452 | 55 | 55 | ||
453 | 56 | def install(self, source, branch="master", dest=None, depth=None): | 56 | def install(self, source, branch="master", dest=None, depth=None): |
454 | @@ -63,6 +63,8 @@ | |||
455 | 63 | branch_name) | 63 | branch_name) |
456 | 64 | try: | 64 | try: |
457 | 65 | self.clone(source, dest_dir, branch, depth) | 65 | self.clone(source, dest_dir, branch, depth) |
458 | 66 | except CalledProcessError as e: | ||
459 | 67 | raise UnhandledSource(e) | ||
460 | 66 | except OSError as e: | 68 | except OSError as e: |
461 | 67 | raise UnhandledSource(e.strerror) | 69 | raise UnhandledSource(e.strerror) |
462 | 68 | return dest_dir | 70 | return dest_dir |
463 | 69 | 71 | ||
464 | === modified file 'tests/charmhelpers/contrib/openstack/amulet/deployment.py' | |||
465 | --- tests/charmhelpers/contrib/openstack/amulet/deployment.py 2016-01-08 13:11:21 +0000 | |||
466 | +++ tests/charmhelpers/contrib/openstack/amulet/deployment.py 2016-01-26 12:00:08 +0000 | |||
467 | @@ -125,7 +125,8 @@ | |||
468 | 125 | 125 | ||
469 | 126 | # Charms which can not use openstack-origin, ie. many subordinates | 126 | # Charms which can not use openstack-origin, ie. many subordinates |
470 | 127 | no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe', | 127 | no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe', |
472 | 128 | 'openvswitch-odl', 'neutron-api-odl', 'odl-controller'] | 128 | 'openvswitch-odl', 'neutron-api-odl', 'odl-controller', |
473 | 129 | 'cinder-backup'] | ||
474 | 129 | 130 | ||
475 | 130 | if self.openstack: | 131 | if self.openstack: |
476 | 131 | for svc in services: | 132 | for svc in services: |
Approved assuming osci is happy