summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorMinghe Ren <mingheren@microsoft.com>2022-11-07 15:01:57 -0800
committerGitHub <noreply@github.com>2022-11-07 17:01:57 -0600
commit699b6a05e20253b3666eb51eb77654741aa7c37d (patch)
treed9ea336511a531f1f44c56286bccad1364997bb0 /cloudinit
parente9fccdb7fe66696ca2df455ecdeea177fa70bfc3 (diff)
downloadcloud-init-git-699b6a05e20253b3666eb51eb77654741aa7c37d.tar.gz
add mariner support (#1780)
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/config/cc_ntp.py10
-rw-r--r--cloudinit/config/cc_resolv_conf.py10
-rw-r--r--cloudinit/config/cc_yum_add_repo.py1
-rw-r--r--cloudinit/distros/__init__.py1
-rw-r--r--cloudinit/distros/mariner.py55
-rw-r--r--cloudinit/util.py1
6 files changed, 77 insertions, 1 deletions
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index b1da3761..8ecc4eb8 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -33,6 +33,7 @@ distros = [
"eurolinux",
"fedora",
"freebsd",
+ "mariner",
"miraclelinux",
"openbsd",
"openEuler",
@@ -141,6 +142,15 @@ DISTRO_CLIENT_CONFIG = {
"template_name": "ntpd.conf.openbsd",
},
},
+ "mariner": {
+ "chrony": {
+ "service_name": "chronyd",
+ },
+ "systemd-timesyncd": {
+ "check_exe": "/usr/lib/systemd/systemd-timesyncd",
+ "confpath": "/etc/systemd/timesyncd.conf",
+ },
+ },
"openbsd": {
"openntpd": {},
},
diff --git a/cloudinit/config/cc_resolv_conf.py b/cloudinit/config/cc_resolv_conf.py
index 3c9ca22e..8dbed71e 100644
--- a/cloudinit/config/cc_resolv_conf.py
+++ b/cloudinit/config/cc_resolv_conf.py
@@ -55,7 +55,15 @@ meta: MetaSchema = {
"name": "Resolv Conf",
"title": "Configure resolv.conf",
"description": MODULE_DESCRIPTION,
- "distros": ["alpine", "fedora", "opensuse", "photon", "rhel", "sles"],
+ "distros": [
+ "alpine",
+ "fedora",
+ "mariner",
+ "opensuse",
+ "photon",
+ "rhel",
+ "sles",
+ ],
"frequency": PER_INSTANCE,
"examples": [
dedent(
diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py
index d570be69..cf81b844 100644
--- a/cloudinit/config/cc_yum_add_repo.py
+++ b/cloudinit/config/cc_yum_add_repo.py
@@ -31,6 +31,7 @@ distros = [
"cloudlinux",
"eurolinux",
"fedora",
+ "mariner",
"openEuler",
"openmandriva",
"photon",
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index 0dd8eb18..1d47c071 100644
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -55,6 +55,7 @@ OSFAMILIES = {
"cloudlinux",
"eurolinux",
"fedora",
+ "mariner",
"miraclelinux",
"openEuler",
"openmandriva",
diff --git a/cloudinit/distros/mariner.py b/cloudinit/distros/mariner.py
new file mode 100644
index 00000000..41b0dc75
--- /dev/null
+++ b/cloudinit/distros/mariner.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python3
+# vi: ts=4 expandtab
+#
+# Copyright (C) 2021 VMware Inc.
+#
+# This file is part of cloud-init. See LICENSE file for license information.
+
+from cloudinit import helpers
+from cloudinit import log as logging
+from cloudinit.distros import photon
+
+LOG = logging.getLogger(__name__)
+
+NETWORK_FILE_HEADER = """\
+# This file is generated from information provided by the datasource. Changes
+# to it will not persist across an instance reboot. To disable cloud-init's
+# network configuration capabilities, write a file
+# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
+# network: {config: disabled}
+"""
+
+
+class Distro(photon.Distro):
+ systemd_hostname_conf_fn = "/etc/hostname"
+ network_conf_dir = "/etc/systemd/network/"
+ systemd_locale_conf_fn = "/etc/locale.conf"
+ resolve_conf_fn = "/etc/systemd/resolved.conf"
+
+ network_conf_fn = {"netplan": "/etc/netplan/50-cloud-init.yaml"}
+ renderer_configs = {
+ "networkd": {
+ "resolv_conf_fn": resolve_conf_fn,
+ "network_conf_dir": network_conf_dir,
+ },
+ "netplan": {
+ "netplan_path": network_conf_fn["netplan"],
+ "netplan_header": NETWORK_FILE_HEADER,
+ "postcmds": "True",
+ },
+ }
+
+ # Should be fqdn if we can use it
+ prefer_fqdn = True
+
+ def __init__(self, name, cfg, paths):
+ photon.Distro.__init__(self, name, cfg, paths)
+ # This will be used to restrict certain
+ # calls from repeatly happening (when they
+ # should only happen say once per instance...)
+ self._runner = helpers.Runners(paths)
+ self.osfamily = "mariner"
+ self.init_cmd = ["systemctl"]
+
+ def _get_localhost_ip(self):
+ return "127.0.0.1"
diff --git a/cloudinit/util.py b/cloudinit/util.py
index ce257c85..1fd2c81b 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -636,6 +636,7 @@ def _get_variant(info):
"debian",
"eurolinux",
"fedora",
+ "mariner",
"miraclelinux",
"openeuler",
"openmandriva",