diff options
author | Conrad Hoffmann <ch@bitfehler.net> | 2019-07-16 19:30:41 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-07-16 19:30:41 +0000 |
commit | a785462959e8746cc16609a159fee33dedd713b1 (patch) | |
tree | 2873a66a74e05e0537bcec8fbda29149e65147a6 /cloudinit/distros | |
parent | a066ccdbb24a0dd7d3dd447a2044110fae9c6abb (diff) | |
download | vyos-cloud-init-a785462959e8746cc16609a159fee33dedd713b1.tar.gz vyos-cloud-init-a785462959e8746cc16609a159fee33dedd713b1.zip |
Support netplan renderer in Arch Linux
Support is for now implemented in such a way that it will fall back to
the old `_write_network()` if netplan is not available on the image.
Diffstat (limited to 'cloudinit/distros')
-rw-r--r-- | cloudinit/distros/arch.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cloudinit/distros/arch.py b/cloudinit/distros/arch.py index b814c8ba..9f89c5f9 100644 --- a/cloudinit/distros/arch.py +++ b/cloudinit/distros/arch.py @@ -12,6 +12,8 @@ from cloudinit import util from cloudinit.distros import net_util from cloudinit.distros.parsers.hostname import HostnameConf +from cloudinit.net.renderers import RendererNotFoundError + from cloudinit.settings import PER_INSTANCE import os @@ -24,6 +26,11 @@ class Distro(distros.Distro): network_conf_dir = "/etc/netctl" resolve_conf_fn = "/etc/resolv.conf" init_cmd = ['systemctl'] # init scripts + renderer_configs = { + "netplan": {"netplan_path": "/etc/netplan/50-cloud-init.yaml", + "netplan_header": "# generated by cloud-init\n", + "postcmds": True} + } def __init__(self, name, cfg, paths): distros.Distro.__init__(self, name, cfg, paths) @@ -50,6 +57,13 @@ class Distro(distros.Distro): self.update_package_sources() self.package_command('', pkgs=pkglist) + def _write_network_config(self, netconfig): + try: + return self._supported_write_network_config(netconfig) + except RendererNotFoundError: + # Fall back to old _write_network + raise NotImplementedError + def _write_network(self, settings): entries = net_util.translate_network(settings) LOG.debug("Translated ubuntu style network settings %s into %s", |