summaryrefslogtreecommitdiff
path: root/cloudinit/distros
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-03-11 15:46:50 -0500
committerScott Moser <smoser@ubuntu.com>2016-03-11 15:46:50 -0500
commitefd22ec256568b655c1dea1c61028b49b7fe04ab (patch)
tree6a253e4881b07263b2d24f375eba68362cc4f9b4 /cloudinit/distros
parentff47d211d507359ad508caafdb413ab9071cd165 (diff)
downloadvyos-cloud-init-efd22ec256568b655c1dea1c61028b49b7fe04ab.tar.gz
vyos-cloud-init-efd22ec256568b655c1dea1c61028b49b7fe04ab.zip
fix use of network state
Diffstat (limited to 'cloudinit/distros')
-rw-r--r--cloudinit/distros/debian.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py
index 89d8d28e..24545fd4 100644
--- a/cloudinit/distros/debian.py
+++ b/cloudinit/distros/debian.py
@@ -44,6 +44,14 @@ APT_GET_WRAPPER = {
}
+def render_network_config(config, target="/"):
+ version = config['version']
+ config = config['config']
+ ns = network_state.NetworkState(version=version, config=config)
+ ns.parse_config()
+ net.render_network_state(target, ns.network_state)
+
+
class Distro(distros.Distro):
hostname_conf_fn = "/etc/hostname"
locale_conf_fn = "/etc/default/locale"
@@ -80,10 +88,7 @@ class Distro(distros.Distro):
def _write_network_config(self, netconfig):
# TODO: THIS IS NOT TESTED
- state = network_state.NetworkState()
- state.load(netconfig)
- state.parse_config()
- net.render_network_state("/", state)
+ render_network_config(netconfig)
return ['all']
def _bring_up_interfaces(self, device_names):