summaryrefslogtreecommitdiff
path: root/cloudinit/distros
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-06-15 23:56:59 -0400
committerScott Moser <smoser@ubuntu.com>2016-06-15 23:56:59 -0400
commit776b0cfe847f531d8d5a235f52673c3da1f06064 (patch)
tree03e7b18a35a0eb33973448b01f4b51bdb2477b80 /cloudinit/distros
parentd598ceeb838b4ccaf667ded84bb02bf096ab7b12 (diff)
parent922562bccbc6b6c7f3309ecd36f1835b2ad817da (diff)
downloadvyos-cloud-init-776b0cfe847f531d8d5a235f52673c3da1f06064.tar.gz
vyos-cloud-init-776b0cfe847f531d8d5a235f52673c3da1f06064.zip
support network rendering to sysconfig (for centos and RHEL)
This intends to add support for rendering of network data under sysconfig distributions (centos and rhel). The end result will be support for network configuration via ConfigDrive or NoCloud on these OS.
Diffstat (limited to 'cloudinit/distros')
-rw-r--r--cloudinit/distros/debian.py12
-rw-r--r--cloudinit/distros/rhel.py8
2 files changed, 14 insertions, 6 deletions
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py
index 603b0b61..53f3aa4d 100644
--- a/cloudinit/distros/debian.py
+++ b/cloudinit/distros/debian.py
@@ -57,7 +57,11 @@ class Distro(distros.Distro):
# should only happen say once per instance...)
self._runner = helpers.Runners(paths)
self.osfamily = 'debian'
- self._net_renderer = eni.Renderer()
+ self._net_renderer = eni.Renderer({
+ 'eni_path': self.network_conf_fn,
+ 'links_prefix_path': self.links_prefix,
+ 'netrules_path': None,
+ })
def apply_locale(self, locale, out_fn=None):
if not out_fn:
@@ -82,12 +86,8 @@ class Distro(distros.Distro):
def _write_network_config(self, netconfig):
ns = parse_net_config_data(netconfig)
- self._net_renderer.render_network_state(
- target="/", network_state=ns,
- eni=self.network_conf_fn, links_prefix=self.links_prefix,
- netrules=None)
+ self._net_renderer.render_network_state("/", ns)
_maybe_remove_legacy_eth0()
-
return []
def _bring_up_interfaces(self, device_names):
diff --git a/cloudinit/distros/rhel.py b/cloudinit/distros/rhel.py
index 812e7002..1aa42d75 100644
--- a/cloudinit/distros/rhel.py
+++ b/cloudinit/distros/rhel.py
@@ -23,6 +23,8 @@
from cloudinit import distros
from cloudinit import helpers
from cloudinit import log as logging
+from cloudinit.net.network_state import parse_net_config_data
+from cloudinit.net import sysconfig
from cloudinit import util
from cloudinit.distros import net_util
@@ -59,10 +61,16 @@ class Distro(distros.Distro):
# should only happen say once per instance...)
self._runner = helpers.Runners(paths)
self.osfamily = 'redhat'
+ self._net_renderer = sysconfig.Renderer()
def install_packages(self, pkglist):
self.package_command('install', pkgs=pkglist)
+ def _write_network_config(self, netconfig):
+ ns = parse_net_config_data(netconfig)
+ self._net_renderer.render_network_state("/", ns)
+ return []
+
def _write_network(self, settings):
# TODO(harlowja) fix this... since this is the ubuntu format
entries = net_util.translate_network(settings)