← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~bitfehler/cloud-init:bitfehler/arch-netplan into cloud-init:master


Conrad Hoffmann has proposed merging ~bitfehler/cloud-init:bitfehler/arch-netplan into cloud-init:master.

Commit message:
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.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
Your team cloud-init commiters is requested to review the proposed merge of ~bitfehler/cloud-init:bitfehler/arch-netplan into cloud-init:master.
diff --git a/cloudinit/distros/arch.py b/cloudinit/distros/arch.py
index b814c8b..9f89c5f 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.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",

Follow ups