Merge lp:~paulgear/charms/trusty/quantum-gateway/ethX-vlan-support into lp:charms/trusty/quantum-gateway

Proposed by Paul Gear
Status: Superseded
Proposed branch: lp:~paulgear/charms/trusty/quantum-gateway/ethX-vlan-support
Merge into: lp:charms/trusty/quantum-gateway
Diff against target: 104 lines (+20/-9)
3 files modified
hooks/charmhelpers/contrib/network/ufw.py (+8/-3)
hooks/charmhelpers/core/host.py (+1/-1)
hooks/charmhelpers/core/sysctl.py (+11/-5)
To merge this branch: bzr merge lp:~paulgear/charms/trusty/quantum-gateway/ethX-vlan-support
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+248323@code.launchpad.net

This proposal has been superseded by a proposal from 2015-02-03.

To post a comment you must log in.

Unmerged revisions

86. By Paul Gear

Merge latest charm-helpers

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/charmhelpers/contrib/network/ufw.py'
--- hooks/charmhelpers/contrib/network/ufw.py 2015-01-23 11:08:26 +0000
+++ hooks/charmhelpers/contrib/network/ufw.py 2015-02-03 00:23:32 +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/core/host.py'
--- hooks/charmhelpers/core/host.py 2015-01-23 11:08:26 +0000
+++ hooks/charmhelpers/core/host.py 2015-02-03 00:23:32 +0000
@@ -361,7 +361,7 @@
361 ip_output = (line for line in ip_output if line)361 ip_output = (line for line in ip_output if line)
362 for line in ip_output:362 for line in ip_output:
363 if line.split()[1].startswith(int_type):363 if line.split()[1].startswith(int_type):
364 matched = re.search('.*: (bond[0-9]+\.[0-9]+)@.*', line)364 matched = re.search('.*: (' + int_type + r'[0-9]+\.[0-9]+)@.*', line)
365 if matched:365 if matched:
366 interface = matched.groups()[0]366 interface = matched.groups()[0]
367 else:367 else:
368368
=== modified file 'hooks/charmhelpers/core/sysctl.py'
--- hooks/charmhelpers/core/sysctl.py 2015-01-23 11:08:26 +0000
+++ hooks/charmhelpers/core/sysctl.py 2015-02-03 00:23:32 +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])

Subscribers

People subscribed via source and target branches