summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2016-05-10 15:12:44 -0700
committerJoshua Harlow <harlowja@gmail.com>2016-05-10 15:12:44 -0700
commitc5eb65ed705475640fce1025c74a54052c6e9731 (patch)
tree41127f6cac3d9707f560fcda15bf23518206cdf6 /cloudinit/net
parent4b0d2430e7674d5abb8fb27ac9ddb129d2bc0715 (diff)
downloadvyos-cloud-init-c5eb65ed705475640fce1025c74a54052c6e9731.tar.gz
vyos-cloud-init-c5eb65ed705475640fce1025c74a54052c6e9731.zip
Add some basic eni rendering tests
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/__init__.py11
-rw-r--r--cloudinit/net/network_state.py2
2 files changed, 6 insertions, 7 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index e911ed0c..0202cbd8 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -107,7 +107,7 @@ class ParserError(Exception):
"""Raised when parser has issue parsing the interfaces file."""
-def parse_net_config_data(net_config):
+def parse_net_config_data(net_config, skip_broken=True):
"""Parses the config, returns NetworkState object
:param net_config: curtin network config dict
@@ -116,20 +116,19 @@ def parse_net_config_data(net_config):
if 'version' in net_config and 'config' in net_config:
ns = network_state.NetworkState(version=net_config.get('version'),
config=net_config.get('config'))
- ns.parse_config()
+ ns.parse_config(skip_broken=skip_broken)
state = ns.network_state
-
return state
-def parse_net_config(path):
+def parse_net_config(path, skip_broken=True):
"""Parses a curtin network configuration file and
return network state"""
ns = None
net_config = util.read_conf(path)
if 'network' in net_config:
- ns = parse_net_config_data(net_config.get('network'))
-
+ ns = parse_net_config_data(net_config.get('network'),
+ skip_broken=skip_broken)
return ns
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index 2530a601..2feffa71 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -142,7 +142,7 @@ class NetworkState(object):
raise RuntimeError("No handler found for"
" command '%s'" % command_type)
try:
- handler(command)
+ handler(self, command)
except InvalidCommand:
if not skip_broken:
raise