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
1=== modified file 'charm-helpers-hooks.yaml'
2--- charm-helpers-hooks.yaml 2015-01-09 15:40:23 +0000
3+++ charm-helpers-hooks.yaml 2015-03-05 11:16:45 +0000
4@@ -1,4 +1,4 @@
5-branch: lp:charm-helpers
6+branch: lp:~openstack-charmers/charm-helpers/stable
7 destination: hooks/charmhelpers
8 include:
9 - core
10
11=== modified file 'charm-helpers-tests.yaml'
12--- charm-helpers-tests.yaml 2014-09-23 10:21:54 +0000
13+++ charm-helpers-tests.yaml 2015-03-05 11:16:45 +0000
14@@ -1,4 +1,4 @@
15-branch: lp:charm-helpers
16+branch: lp:~openstack-charmers/charm-helpers/stable
17 destination: tests/charmhelpers
18 include:
19 - contrib.amulet
20
21=== modified file 'hooks/charmhelpers/contrib/network/ufw.py'
22--- hooks/charmhelpers/contrib/network/ufw.py 2015-01-26 09:46:57 +0000
23+++ hooks/charmhelpers/contrib/network/ufw.py 2015-03-05 11:16:45 +0000
24@@ -53,6 +53,7 @@
25 :returns: True if ufw is enabled
26 """
27 output = subprocess.check_output(['ufw', 'status'],
28+ universal_newlines=True,
29 env={'LANG': 'en_US',
30 'PATH': os.environ['PATH']})
31
32@@ -82,6 +83,7 @@
33 raise Exception("Couldn't disable IPv6 support in ufw")
34
35 output = subprocess.check_output(['ufw', 'enable'],
36+ universal_newlines=True,
37 env={'LANG': 'en_US',
38 'PATH': os.environ['PATH']})
39
40@@ -107,6 +109,7 @@
41 return True
42
43 output = subprocess.check_output(['ufw', 'disable'],
44+ universal_newlines=True,
45 env={'LANG': 'en_US',
46 'PATH': os.environ['PATH']})
47
48@@ -151,7 +154,7 @@
49 cmd += ['to', dst]
50
51 if port is not None:
52- cmd += ['port', port]
53+ cmd += ['port', str(port)]
54
55 if proto is not None:
56 cmd += ['proto', proto]
57@@ -208,9 +211,11 @@
58 :param action: `open` or `close`
59 """
60 if action == 'open':
61- subprocess.check_output(['ufw', 'allow', name])
62+ subprocess.check_output(['ufw', 'allow', str(name)],
63+ universal_newlines=True)
64 elif action == 'close':
65- subprocess.check_output(['ufw', 'delete', 'allow', name])
66+ subprocess.check_output(['ufw', 'delete', 'allow', str(name)],
67+ universal_newlines=True)
68 else:
69 raise Exception(("'{}' not supported, use 'allow' "
70 "or 'delete'").format(action))
71
72=== modified file 'hooks/charmhelpers/contrib/openstack/context.py'
73--- hooks/charmhelpers/contrib/openstack/context.py 2015-01-26 09:46:57 +0000
74+++ hooks/charmhelpers/contrib/openstack/context.py 2015-03-05 11:16:45 +0000
75@@ -191,7 +191,7 @@
76 unit=local_unit())
77 if set_hostname != access_hostname:
78 relation_set(relation_settings={hostname_key: access_hostname})
79- return ctxt # Defer any further hook execution for now....
80+ return None # Defer any further hook execution for now....
81
82 password_setting = 'password'
83 if self.relation_prefix:
84
85=== modified file 'hooks/charmhelpers/core/sysctl.py'
86--- hooks/charmhelpers/core/sysctl.py 2015-01-26 09:46:57 +0000
87+++ hooks/charmhelpers/core/sysctl.py 2015-03-05 11:16:45 +0000
88@@ -26,25 +26,31 @@
89 from charmhelpers.core.hookenv import (
90 log,
91 DEBUG,
92+ ERROR,
93 )
94
95
96 def create(sysctl_dict, sysctl_file):
97 """Creates a sysctl.conf file from a YAML associative array
98
99- :param sysctl_dict: a dict of sysctl options eg { 'kernel.max_pid': 1337 }
100- :type sysctl_dict: dict
101+ :param sysctl_dict: a YAML-formatted string of sysctl options eg "{ 'kernel.max_pid': 1337 }"
102+ :type sysctl_dict: str
103 :param sysctl_file: path to the sysctl file to be saved
104 :type sysctl_file: str or unicode
105 :returns: None
106 """
107- sysctl_dict = yaml.load(sysctl_dict)
108+ try:
109+ sysctl_dict_parsed = yaml.safe_load(sysctl_dict)
110+ except yaml.YAMLError:
111+ log("Error parsing YAML sysctl_dict: {}".format(sysctl_dict),
112+ level=ERROR)
113+ return
114
115 with open(sysctl_file, "w") as fd:
116- for key, value in sysctl_dict.items():
117+ for key, value in sysctl_dict_parsed.items():
118 fd.write("{}={}\n".format(key, value))
119
120- log("Updating sysctl_file: %s values: %s" % (sysctl_file, sysctl_dict),
121+ log("Updating sysctl_file: %s values: %s" % (sysctl_file, sysctl_dict_parsed),
122 level=DEBUG)
123
124 check_call(["sysctl", "-p", sysctl_file])
125
126=== modified file 'hooks/nova_compute_context.py'
127--- hooks/nova_compute_context.py 2014-12-15 10:28:47 +0000
128+++ hooks/nova_compute_context.py 2015-03-05 11:16:45 +0000
129@@ -421,9 +421,8 @@
130 def __call__(self):
131 ctxt = super(NeutronComputeContext, self).__call__()
132 # NOTE(jamespage) support override of neutron security via config
133- if config('disable-neutron-security-groups') is not None:
134- ctxt['disable_neutron_security_groups'] = \
135- config('disable-neutron-security-groups')
136+ if config('disable-neutron-security-groups'):
137+ ctxt['disable_neutron_security_groups'] = True
138 return ctxt
139
140
141
142=== modified file 'unit_tests/test_nova_compute_contexts.py'
143--- unit_tests/test_nova_compute_contexts.py 2014-12-03 23:23:54 +0000
144+++ unit_tests/test_nova_compute_contexts.py 2015-03-05 11:16:45 +0000
145@@ -202,8 +202,7 @@
146 self.test_config.set('disable-neutron-security-groups', False)
147 qplugin = context.NeutronComputeContext()
148 with patch.object(qplugin, '_ensure_packages'):
149- self.assertEquals({'disable_neutron_security_groups': False},
150- qplugin())
151+ self.assertEquals({}, qplugin())
152
153 @patch('subprocess.call')
154 def test_host_IP_context(self, _call):

Subscribers

People subscribed via source and target branches