diff options
author | Janos Lenart <ocsi@debian.org> | 2019-07-15 21:26:50 +0000 |
---|---|---|
committer | Daniil Baturin <dmbaturin@careless.baturin.tld> | 2020-01-23 07:58:26 +0700 |
commit | 40d2fd6dce642596657373b4e51d27d8cfab8e5a (patch) | |
tree | 44d8c5d0621d74689bd8c6146c2f2fd49916dd64 | |
parent | 012ccd611d4e9e632a9e210a639d3cba36431bf3 (diff) | |
download | vyos-cloud-init-40d2fd6dce642596657373b4e51d27d8cfab8e5a.tar.gz vyos-cloud-init-40d2fd6dce642596657373b4e51d27d8cfab8e5a.zip |
Update debian eni network configuration location, retain Ubuntu setting
On Debian, ifupdown uses `source-directory /etc/network/interfaces.d`
(for new installs) to include files.
https://salsa.debian.org/debian/ifupdown/blob/master/debian/postinst#L23
The current filename, 50-cloud-init.cfg, does not match against the RE
that is used to scan the directory for configurations (ASCII upper- and
lower-case letters, ASCII digits, ASCII underscores, and ASCII
minus-hyphens):
https://salsa.debian.org/debian/ifupdown/blob/master/interfaces.5.pre#L122
Of course many installations use `source /etc/network/interfaces.d/*`,
but not all.
-rw-r--r-- | cloudinit/distros/debian.py | 4 | ||||
-rw-r--r-- | cloudinit/distros/ubuntu.py | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py index d517fb88..0ad93ffe 100644 --- a/cloudinit/distros/debian.py +++ b/cloudinit/distros/debian.py @@ -36,14 +36,14 @@ ENI_HEADER = """# This file is generated from information provided by # network: {config: disabled} """ -NETWORK_CONF_FN = "/etc/network/interfaces.d/50-cloud-init.cfg" +NETWORK_CONF_FN = "/etc/network/interfaces.d/50-cloud-init" LOCALE_CONF_FN = "/etc/default/locale" class Distro(distros.Distro): hostname_conf_fn = "/etc/hostname" network_conf_fn = { - "eni": "/etc/network/interfaces.d/50-cloud-init.cfg", + "eni": "/etc/network/interfaces.d/50-cloud-init", "netplan": "/etc/netplan/50-cloud-init.yaml" } renderer_configs = { diff --git a/cloudinit/distros/ubuntu.py b/cloudinit/distros/ubuntu.py index 68154104..e5fcbc58 100644 --- a/cloudinit/distros/ubuntu.py +++ b/cloudinit/distros/ubuntu.py @@ -21,6 +21,21 @@ LOG = logging.getLogger(__name__) class Distro(debian.Distro): + def __init__(self, name, cfg, paths): + super(Distro, self).__init__(name, cfg, paths) + # Ubuntu specific network cfg locations + self.network_conf_fn = { + "eni": "/etc/network/interfaces.d/50-cloud-init.cfg", + "netplan": "/etc/netplan/50-cloud-init.yaml" + } + self.renderer_configs = { + "eni": {"eni_path": self.network_conf_fn["eni"], + "eni_header": debian.ENI_HEADER}, + "netplan": {"netplan_path": self.network_conf_fn["netplan"], + "netplan_header": debian.ENI_HEADER, + "postcmds": True} + } + @property def preferred_ntp_clients(self): """The preferred ntp client is dependent on the version.""" |