2020-07-31 15:06:51 +08:00
|
|
|
From 098429a75ea00df1d8a5670e45df6babfc37f327 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: chengquan <chengquan3@huawei.com>
|
|
|
|
|
Date: Thu, 8 Aug 2019 16:11:58 +0800
|
|
|
|
|
Subject: [PATCH] cloud-init: cloud-init add openEuler os
|
|
|
|
|
|
|
|
|
|
reason: add openEuler into distros
|
|
|
|
|
|
|
|
|
|
Signed-off-by: chengquan <chengquan3@huawei.com>
|
|
|
|
|
---
|
2022-03-31 14:22:42 +08:00
|
|
|
cloudinit/config/cc_ntp.py | 2 +-
|
|
|
|
|
cloudinit/config/cc_resolv_conf.py | 2 +-
|
|
|
|
|
cloudinit/config/cc_rh_subscription.py | 2 +-
|
|
|
|
|
cloudinit/config/cc_spacewalk.py | 2 +-
|
|
|
|
|
cloudinit/config/cc_yum_add_repo.py | 2 +-
|
|
|
|
|
cloudinit/distros/__init__.py | 2 +-
|
|
|
|
|
cloudinit/distros/openeuler.py | 12 ++++++++++++
|
|
|
|
|
config/cloud.cfg.tmpl | 8 ++++----
|
|
|
|
|
systemd/cloud-init-generator.tmpl | 2 +-
|
|
|
|
|
systemd/cloud-init.service.tmpl | 2 +-
|
2022-07-28 16:58:38 +08:00
|
|
|
tests/unittests/test_cli.py | 2 +-
|
2022-03-31 14:22:42 +08:00
|
|
|
tools/render-cloudcfg | 2 +-
|
|
|
|
|
12 files changed, 26 insertions(+), 14 deletions(-)
|
|
|
|
|
create mode 100644 cloudinit/distros/openeuler.py
|
2020-07-31 15:06:51 +08:00
|
|
|
|
|
|
|
|
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
|
2022-07-28 16:58:38 +08:00
|
|
|
index 3bc1d30..6b0f302 100644
|
2020-07-31 15:06:51 +08:00
|
|
|
--- a/cloudinit/config/cc_ntp.py
|
|
|
|
|
+++ b/cloudinit/config/cc_ntp.py
|
2022-07-28 16:58:38 +08:00
|
|
|
@@ -29,7 +29,7 @@ distros = [
|
2022-03-31 14:22:42 +08:00
|
|
|
"eurolinux",
|
|
|
|
|
"fedora",
|
|
|
|
|
"miraclelinux",
|
|
|
|
|
- "openEuler",
|
|
|
|
|
+ "openeuler",
|
|
|
|
|
"opensuse",
|
|
|
|
|
"photon",
|
|
|
|
|
"rhel",
|
2020-07-31 15:06:51 +08:00
|
|
|
diff --git a/cloudinit/config/cc_resolv_conf.py b/cloudinit/config/cc_resolv_conf.py
|
2022-07-28 16:58:38 +08:00
|
|
|
index bbf6807..845e793 100644
|
2020-07-31 15:06:51 +08:00
|
|
|
--- a/cloudinit/config/cc_resolv_conf.py
|
|
|
|
|
+++ b/cloudinit/config/cc_resolv_conf.py
|
2022-07-28 16:58:38 +08:00
|
|
|
@@ -52,7 +52,7 @@ meta: MetaSchema = {
|
|
|
|
|
"name": "Resolv Conf",
|
|
|
|
|
"title": "Configure resolv.conf",
|
|
|
|
|
"description": MODULE_DESCRIPTION,
|
|
|
|
|
- "distros": ["alpine", "fedora", "opensuse", "photon", "rhel", "sles"],
|
|
|
|
|
+ "distros": ["alpine", "fedora", "opensuse", "photon", "rhel", "sles", "openeuler"],
|
|
|
|
|
"frequency": PER_INSTANCE,
|
|
|
|
|
"examples": [
|
|
|
|
|
dedent(
|
2020-07-31 15:06:51 +08:00
|
|
|
diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py
|
2022-07-28 16:58:38 +08:00
|
|
|
index b742cb9..4d8244f 100644
|
2020-07-31 15:06:51 +08:00
|
|
|
--- a/cloudinit/config/cc_rh_subscription.py
|
|
|
|
|
+++ b/cloudinit/config/cc_rh_subscription.py
|
2022-07-28 16:58:38 +08:00
|
|
|
@@ -30,7 +30,7 @@ meta: MetaSchema = {
|
|
|
|
|
"name": "Red Hat Subscription",
|
|
|
|
|
"title": "Register Red Hat Enterprise Linux based system",
|
|
|
|
|
"description": MODULE_DESCRIPTION,
|
|
|
|
|
- "distros": ["fedora", "rhel"],
|
|
|
|
|
+ "distros": ["fedora", "rhel", "openeuler"],
|
|
|
|
|
"frequency": PER_INSTANCE,
|
|
|
|
|
"examples": [
|
|
|
|
|
dedent(
|
2020-07-31 15:06:51 +08:00
|
|
|
diff --git a/cloudinit/config/cc_spacewalk.py b/cloudinit/config/cc_spacewalk.py
|
2022-07-28 16:58:38 +08:00
|
|
|
index 6820a81..d97da92 100644
|
2020-07-31 15:06:51 +08:00
|
|
|
--- a/cloudinit/config/cc_spacewalk.py
|
|
|
|
|
+++ b/cloudinit/config/cc_spacewalk.py
|
2022-07-28 16:58:38 +08:00
|
|
|
@@ -22,7 +22,7 @@ meta: MetaSchema = {
|
|
|
|
|
"name": "Spacewalk",
|
|
|
|
|
"title": "Install and configure spacewalk",
|
|
|
|
|
"description": MODULE_DESCRIPTION,
|
|
|
|
|
- "distros": ["rhel", "fedora"],
|
|
|
|
|
+ "distros": ["rhel", "fedora", "openeuler"],
|
|
|
|
|
"frequency": PER_INSTANCE,
|
|
|
|
|
"examples": [
|
|
|
|
|
dedent(
|
2020-07-31 15:06:51 +08:00
|
|
|
diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py
|
2022-07-28 16:58:38 +08:00
|
|
|
index f735719..cc787a3 100644
|
2020-07-31 15:06:51 +08:00
|
|
|
--- a/cloudinit/config/cc_yum_add_repo.py
|
|
|
|
|
+++ b/cloudinit/config/cc_yum_add_repo.py
|
2022-07-28 16:58:38 +08:00
|
|
|
@@ -28,7 +28,7 @@ distros = [
|
2022-03-31 14:22:42 +08:00
|
|
|
"cloudlinux",
|
|
|
|
|
"eurolinux",
|
|
|
|
|
"fedora",
|
|
|
|
|
- "openEuler",
|
|
|
|
|
+ "openeuler",
|
|
|
|
|
"photon",
|
|
|
|
|
"rhel",
|
|
|
|
|
"rocky",
|
2020-07-31 15:06:51 +08:00
|
|
|
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
|
2022-07-28 16:58:38 +08:00
|
|
|
index b034e2c..be063c2 100644
|
2020-07-31 15:06:51 +08:00
|
|
|
--- a/cloudinit/distros/__init__.py
|
|
|
|
|
+++ b/cloudinit/distros/__init__.py
|
2022-03-31 14:22:42 +08:00
|
|
|
@@ -46,7 +46,7 @@ OSFAMILIES = {
|
|
|
|
|
"eurolinux",
|
|
|
|
|
"fedora",
|
|
|
|
|
"miraclelinux",
|
|
|
|
|
- "openEuler",
|
|
|
|
|
+ "openeuler",
|
|
|
|
|
"photon",
|
|
|
|
|
"rhel",
|
|
|
|
|
"rocky",
|
|
|
|
|
diff --git a/cloudinit/distros/openeuler.py b/cloudinit/distros/openeuler.py
|
2020-11-04 10:20:14 +08:00
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000..7505ca4
|
|
|
|
|
--- /dev/null
|
2022-03-31 14:22:42 +08:00
|
|
|
+++ b/cloudinit/distros/openeuler.py
|
2020-11-04 10:20:14 +08:00
|
|
|
@@ -0,0 +1,12 @@
|
|
|
|
|
+# Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
|
|
|
|
|
+# This file is part of cloud-init. See LICENSE file for license information.
|
|
|
|
|
+
|
|
|
|
|
+from cloudinit.distros import rhel
|
|
|
|
|
+from cloudinit import log as logging
|
|
|
|
|
+
|
|
|
|
|
+LOG = logging.getLogger(__name__)
|
|
|
|
|
+
|
|
|
|
|
+class Distro(rhel.Distro):
|
|
|
|
|
+ pass
|
|
|
|
|
+
|
|
|
|
|
+# vi: ts=4 expandtab
|
2020-07-31 15:06:51 +08:00
|
|
|
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
|
2022-07-28 16:58:38 +08:00
|
|
|
index 6951a0e..8740752 100644
|
2020-07-31 15:06:51 +08:00
|
|
|
--- a/config/cloud.cfg.tmpl
|
|
|
|
|
+++ b/config/cloud.cfg.tmpl
|
2022-03-31 14:22:42 +08:00
|
|
|
@@ -33,7 +33,7 @@ disable_root: true
|
2020-07-31 15:06:51 +08:00
|
|
|
{% endif %}
|
2022-07-28 16:58:38 +08:00
|
|
|
|
2022-03-31 14:22:42 +08:00
|
|
|
{% if variant in ["almalinux", "alpine", "amazon", "centos", "cloudlinux", "eurolinux",
|
|
|
|
|
- "fedora", "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %}
|
|
|
|
|
+ "fedora", "miraclelinux", "openeuler", "rhel", "rocky", "virtuozzo"] %}
|
2022-07-28 16:58:38 +08:00
|
|
|
{% if variant == "rhel" %}
|
|
|
|
|
mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service,_netdev', '0', '2']
|
|
|
|
|
{% else %}
|
|
|
|
|
@@ -125,7 +125,7 @@ cloud_config_modules:
|
|
|
|
|
{% if variant in ["rhel"] %}
|
|
|
|
|
- rh_subscription
|
2022-03-31 14:22:42 +08:00
|
|
|
{% endif %}
|
|
|
|
|
-{% if variant in ["rhel", "fedora", "photon"] %}
|
|
|
|
|
+{% if variant in ["rhel", "fedora", "photon", "openeuler"] %}
|
|
|
|
|
{% if variant not in ["photon"] %}
|
2020-07-31 15:06:51 +08:00
|
|
|
- spacewalk
|
|
|
|
|
{% endif %}
|
2022-07-28 16:58:38 +08:00
|
|
|
@@ -191,7 +191,7 @@ cloud_final_modules:
|
2022-03-31 14:22:42 +08:00
|
|
|
system_info:
|
2020-07-31 15:06:51 +08:00
|
|
|
# This will affect which distro class gets used
|
2022-03-31 14:22:42 +08:00
|
|
|
{% if variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "debian",
|
|
|
|
|
- "eurolinux", "fedora", "freebsd", "gentoo", "netbsd", "miraclelinux", "openbsd", "openEuler",
|
|
|
|
|
+ "eurolinux", "fedora", "freebsd", "gentoo", "netbsd", "miraclelinux", "openbsd", "openeuler",
|
|
|
|
|
"photon", "rhel", "rocky", "suse", "ubuntu", "virtuozzo"] %}
|
2020-07-31 15:06:51 +08:00
|
|
|
distro: {{ variant }}
|
2022-03-31 14:22:42 +08:00
|
|
|
{% elif variant in ["dragonfly"] %}
|
2022-07-28 16:58:38 +08:00
|
|
|
@@ -245,7 +245,7 @@ system_info:
|
2020-07-31 15:06:51 +08:00
|
|
|
security: http://ports.ubuntu.com/ubuntu-ports
|
|
|
|
|
ssh_svcname: ssh
|
2022-03-31 14:22:42 +08:00
|
|
|
{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "eurolinux",
|
|
|
|
|
- "fedora", "gentoo", "miraclelinux", "openEuler", "rhel", "rocky", "suse", "virtuozzo"] %}
|
|
|
|
|
+ "fedora", "gentoo", "miraclelinux", "openeuler", "rhel", "rocky", "suse", "virtuozzo"] %}
|
2020-07-31 15:06:51 +08:00
|
|
|
# Default user name + that default users groups (if added/used)
|
|
|
|
|
default_user:
|
2020-11-04 10:20:14 +08:00
|
|
|
{% if variant == "amazon" %}
|
2022-07-28 16:58:38 +08:00
|
|
|
diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl
|
|
|
|
|
index 6689309..12aa52f 100644
|
|
|
|
|
--- a/systemd/cloud-init-generator.tmpl
|
|
|
|
|
+++ b/systemd/cloud-init-generator.tmpl
|
|
|
|
|
@@ -21,7 +21,7 @@ CLOUD_SYSTEM_TARGET="/usr/lib/systemd/system/cloud-init.target"
|
|
|
|
|
CLOUD_SYSTEM_TARGET="/lib/systemd/system/cloud-init.target"
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
|
|
|
|
|
- "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %}
|
|
|
|
|
+ "miraclelinux", "openeuler", "rhel", "rocky", "virtuozzo"] %}
|
|
|
|
|
dsidentify="/usr/libexec/cloud-init/ds-identify"
|
|
|
|
|
{% else %}
|
|
|
|
|
dsidentify="/usr/lib/cloud-init/ds-identify"
|
2020-07-31 15:06:51 +08:00
|
|
|
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
|
2022-07-28 16:58:38 +08:00
|
|
|
index c170aef..0ec2636 100644
|
2020-07-31 15:06:51 +08:00
|
|
|
--- a/systemd/cloud-init.service.tmpl
|
|
|
|
|
+++ b/systemd/cloud-init.service.tmpl
|
2022-03-31 14:22:42 +08:00
|
|
|
@@ -13,7 +13,7 @@ After=systemd-networkd-wait-online.service
|
2020-07-31 15:06:51 +08:00
|
|
|
After=networking.service
|
|
|
|
|
{% endif %}
|
2022-03-31 14:22:42 +08:00
|
|
|
{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
|
|
|
|
|
- "miraclelinux", "openEuler", "rhel", "rocky", "virtuozzo"] %}
|
|
|
|
|
+ "miraclelinux", "openeuler", "rhel", "rocky", "virtuozzo"] %}
|
2020-07-31 15:06:51 +08:00
|
|
|
After=network.service
|
|
|
|
|
After=NetworkManager.service
|
|
|
|
|
{% endif %}
|
2022-07-28 16:58:38 +08:00
|
|
|
diff --git a/tests/unittests/test_cli.py b/tests/unittests/test_cli.py
|
|
|
|
|
index 7846d0d..0c525dd 100644
|
|
|
|
|
--- a/tests/unittests/test_cli.py
|
|
|
|
|
+++ b/tests/unittests/test_cli.py
|
|
|
|
|
@@ -260,7 +260,7 @@ class TestCLI(test_helpers.FilesystemMockingTestCase):
|
|
|
|
|
"**Supported distros:** all",
|
|
|
|
|
"**Supported distros:** almalinux, alpine, centos, "
|
|
|
|
|
"cloudlinux, debian, eurolinux, fedora, miraclelinux, "
|
|
|
|
|
- "openEuler, opensuse, photon, rhel, rocky, sles, ubuntu, "
|
|
|
|
|
+ "openeuler, opensuse, photon, rhel, rocky, sles, ubuntu, "
|
|
|
|
|
"virtuozzo",
|
|
|
|
|
"**Config schema**:\n **resize_rootfs:** "
|
|
|
|
|
"(``true``/``false``/``noblock``)",
|
2020-07-31 15:06:51 +08:00
|
|
|
diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
|
2022-07-28 16:58:38 +08:00
|
|
|
index afe999e..cc9f054 100755
|
2020-07-31 15:06:51 +08:00
|
|
|
--- a/tools/render-cloudcfg
|
|
|
|
|
+++ b/tools/render-cloudcfg
|
2022-03-31 14:22:42 +08:00
|
|
|
@@ -24,7 +24,7 @@ def main():
|
|
|
|
|
"miraclelinux",
|
|
|
|
|
"netbsd",
|
|
|
|
|
"openbsd",
|
|
|
|
|
- "openEuler",
|
|
|
|
|
+ "openeuler",
|
|
|
|
|
"photon",
|
|
|
|
|
"rhel",
|
|
|
|
|
"suse",
|
|
|
|
|
--
|
2022-07-28 16:58:38 +08:00
|
|
|
2.27.0
|
2022-03-31 14:22:42 +08:00
|
|
|
|