Merge lp:~james-page/charms/trusty/nova-compute/stable-bug-1413862 into lp:~openstack-charmers-archive/charms/trusty/nova-compute/trunk

Proposed by James Page
Status: Merged
Merged at revision: 100
Proposed branch: lp:~james-page/charms/trusty/nova-compute/stable-bug-1413862
Merge into: lp:~openstack-charmers-archive/charms/trusty/nova-compute/trunk
Diff against target: 154 lines (+25/-16)
7 files modified
charm-helpers-hooks.yaml (+1/-1)
charm-helpers-tests.yaml (+1/-1)
hooks/charmhelpers/contrib/network/ufw.py (+8/-3)
hooks/charmhelpers/contrib/openstack/context.py (+1/-1)
hooks/charmhelpers/core/sysctl.py (+11/-5)
hooks/nova_compute_context.py (+2/-3)
unit_tests/test_nova_compute_contexts.py (+1/-2)
To merge this branch: bzr merge lp:~james-page/charms/trusty/nova-compute/stable-bug-1413862
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+251903@code.launchpad.net

Commit message

Resync helpers to resolve race condition when access-network is set in mysql or percona-cluster charms

Description of the change

Resync helpers to resolve race condition when access-network is set in mysql or percona-cluster charms

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

charm_lint_check #2480 nova-compute for james-page mp251903
    LINT OK: passed

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

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

charm_unit_test #2270 nova-compute for james-page mp251903
    UNIT OK: passed

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

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

charm_amulet_test #2353 nova-compute for james-page mp251903
    AMULET OK: passed

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

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 'charm-helpers-hooks.yaml'
--- charm-helpers-hooks.yaml 2015-01-09 15:40:23 +0000
+++ charm-helpers-hooks.yaml 2015-03-05 11:16:45 +0000
@@ -1,4 +1,4 @@
1branch: lp:charm-helpers1branch: lp:~openstack-charmers/charm-helpers/stable
2destination: hooks/charmhelpers2destination: hooks/charmhelpers
3include:3include:
4 - core4 - core
55
=== modified file 'charm-helpers-tests.yaml'
--- charm-helpers-tests.yaml 2014-09-23 10:21:54 +0000
+++ charm-helpers-tests.yaml 2015-03-05 11:16:45 +0000
@@ -1,4 +1,4 @@
1branch: lp:charm-helpers1branch: lp:~openstack-charmers/charm-helpers/stable
2destination: tests/charmhelpers2destination: tests/charmhelpers
3include:3include:
4 - contrib.amulet4 - contrib.amulet
55
=== modified file 'hooks/charmhelpers/contrib/network/ufw.py'
--- hooks/charmhelpers/contrib/network/ufw.py 2015-01-26 09:46:57 +0000
+++ hooks/charmhelpers/contrib/network/ufw.py 2015-03-05 11:16:45 +0000
@@ -53,6 +53,7 @@
53 :returns: True if ufw is enabled53 :returns: True if ufw is enabled
54 """54 """
55 output = subprocess.check_output(['ufw', 'status'],55 output = subprocess.check_output(['ufw', 'status'],
56 universal_newlines=True,
56 env={'LANG': 'en_US',57 env={'LANG': 'en_US',
57 'PATH': os.environ['PATH']})58 'PATH': os.environ['PATH']})
5859
@@ -82,6 +83,7 @@
82 raise Exception("Couldn't disable IPv6 support in ufw")83 raise Exception("Couldn't disable IPv6 support in ufw")
8384
84 output = subprocess.check_output(['ufw', 'enable'],85 output = subprocess.check_output(['ufw', 'enable'],
86 universal_newlines=True,
85 env={'LANG': 'en_US',87 env={'LANG': 'en_US',
86 'PATH': os.environ['PATH']})88 'PATH': os.environ['PATH']})
8789
@@ -107,6 +109,7 @@
107 return True109 return True
108110
109 output = subprocess.check_output(['ufw', 'disable'],111 output = subprocess.check_output(['ufw', 'disable'],
112 universal_newlines=True,
110 env={'LANG': 'en_US',113 env={'LANG': 'en_US',
111 'PATH': os.environ['PATH']})114 'PATH': os.environ['PATH']})
112115
@@ -151,7 +154,7 @@
151 cmd += ['to', dst]154 cmd += ['to', dst]
152155
153 if port is not None:156 if port is not None:
154 cmd += ['port', port]157 cmd += ['port', str(port)]
155158
156 if proto is not None:159 if proto is not None:
157 cmd += ['proto', proto]160 cmd += ['proto', proto]
@@ -208,9 +211,11 @@
208 :param action: `open` or `close`211 :param action: `open` or `close`
209 """212 """
210 if action == 'open':213 if action == 'open':
211 subprocess.check_output(['ufw', 'allow', name])214 subprocess.check_output(['ufw', 'allow', str(name)],
215 universal_newlines=True)
212 elif action == 'close':216 elif action == 'close':
213 subprocess.check_output(['ufw', 'delete', 'allow', name])217 subprocess.check_output(['ufw', 'delete', 'allow', str(name)],
218 universal_newlines=True)
214 else:219 else:
215 raise Exception(("'{}' not supported, use 'allow' "220 raise Exception(("'{}' not supported, use 'allow' "
216 "or 'delete'").format(action))221 "or 'delete'").format(action))
217222
=== modified file 'hooks/charmhelpers/contrib/openstack/context.py'
--- hooks/charmhelpers/contrib/openstack/context.py 2015-01-26 09:46:57 +0000
+++ hooks/charmhelpers/contrib/openstack/context.py 2015-03-05 11:16:45 +0000
@@ -191,7 +191,7 @@
191 unit=local_unit())191 unit=local_unit())
192 if set_hostname != access_hostname:192 if set_hostname != access_hostname:
193 relation_set(relation_settings={hostname_key: access_hostname})193 relation_set(relation_settings={hostname_key: access_hostname})
194 return ctxt # Defer any further hook execution for now....194 return None # Defer any further hook execution for now....
195195
196 password_setting = 'password'196 password_setting = 'password'
197 if self.relation_prefix:197 if self.relation_prefix:
198198
=== modified file 'hooks/charmhelpers/core/sysctl.py'
--- hooks/charmhelpers/core/sysctl.py 2015-01-26 09:46:57 +0000
+++ hooks/charmhelpers/core/sysctl.py 2015-03-05 11:16:45 +0000
@@ -26,25 +26,31 @@
26from charmhelpers.core.hookenv import (26from charmhelpers.core.hookenv import (
27 log,27 log,
28 DEBUG,28 DEBUG,
29 ERROR,
29)30)
3031
3132
32def create(sysctl_dict, sysctl_file):33def create(sysctl_dict, sysctl_file):
33 """Creates a sysctl.conf file from a YAML associative array34 """Creates a sysctl.conf file from a YAML associative array
3435
35 :param sysctl_dict: a dict of sysctl options eg { 'kernel.max_pid': 1337 }36 :param sysctl_dict: a YAML-formatted string of sysctl options eg "{ 'kernel.max_pid': 1337 }"
36 :type sysctl_dict: dict37 :type sysctl_dict: str
37 :param sysctl_file: path to the sysctl file to be saved38 :param sysctl_file: path to the sysctl file to be saved
38 :type sysctl_file: str or unicode39 :type sysctl_file: str or unicode
39 :returns: None40 :returns: None
40 """41 """
41 sysctl_dict = yaml.load(sysctl_dict)42 try:
43 sysctl_dict_parsed = yaml.safe_load(sysctl_dict)
44 except yaml.YAMLError:
45 log("Error parsing YAML sysctl_dict: {}".format(sysctl_dict),
46 level=ERROR)
47 return
4248
43 with open(sysctl_file, "w") as fd:49 with open(sysctl_file, "w") as fd:
44 for key, value in sysctl_dict.items():50 for key, value in sysctl_dict_parsed.items():
45 fd.write("{}={}\n".format(key, value))51 fd.write("{}={}\n".format(key, value))
4652
47 log("Updating sysctl_file: %s values: %s" % (sysctl_file, sysctl_dict),53 log("Updating sysctl_file: %s values: %s" % (sysctl_file, sysctl_dict_parsed),
48 level=DEBUG)54 level=DEBUG)
4955
50 check_call(["sysctl", "-p", sysctl_file])56 check_call(["sysctl", "-p", sysctl_file])
5157
=== modified file 'hooks/nova_compute_context.py'
--- hooks/nova_compute_context.py 2014-12-15 10:28:47 +0000
+++ hooks/nova_compute_context.py 2015-03-05 11:16:45 +0000
@@ -421,9 +421,8 @@
421 def __call__(self):421 def __call__(self):
422 ctxt = super(NeutronComputeContext, self).__call__()422 ctxt = super(NeutronComputeContext, self).__call__()
423 # NOTE(jamespage) support override of neutron security via config423 # NOTE(jamespage) support override of neutron security via config
424 if config('disable-neutron-security-groups') is not None:424 if config('disable-neutron-security-groups'):
425 ctxt['disable_neutron_security_groups'] = \425 ctxt['disable_neutron_security_groups'] = True
426 config('disable-neutron-security-groups')
427 return ctxt426 return ctxt
428427
429428
430429
=== modified file 'unit_tests/test_nova_compute_contexts.py'
--- unit_tests/test_nova_compute_contexts.py 2014-12-03 23:23:54 +0000
+++ unit_tests/test_nova_compute_contexts.py 2015-03-05 11:16:45 +0000
@@ -202,8 +202,7 @@
202 self.test_config.set('disable-neutron-security-groups', False)202 self.test_config.set('disable-neutron-security-groups', False)
203 qplugin = context.NeutronComputeContext()203 qplugin = context.NeutronComputeContext()
204 with patch.object(qplugin, '_ensure_packages'):204 with patch.object(qplugin, '_ensure_packages'):
205 self.assertEquals({'disable_neutron_security_groups': False},205 self.assertEquals({}, qplugin())
206 qplugin())
207206
208 @patch('subprocess.call')207 @patch('subprocess.call')
209 def test_host_IP_context(self, _call):208 def test_host_IP_context(self, _call):

Subscribers

People subscribed via source and target branches