summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhuzaifangxuele <52022596+zhuzaifangxuele@users.noreply.github.com>2021-09-14 02:21:28 +0800
committerGitHub <noreply@github.com>2021-09-13 13:21:28 -0500
commitf4c47e3e25d1fb79e2673e37f8fc67750d025be2 (patch)
treed3fd670589ff11d203afd2973f926cc0bff44120
parent2ce857248162957a785af61c135ca8433fdbbcde (diff)
downloadvyos-cloud-init-f4c47e3e25d1fb79e2673e37f8fc67750d025be2.tar.gz
vyos-cloud-init-f4c47e3e25d1fb79e2673e37f8fc67750d025be2.zip
Support openEuler OS (#1012)
openEuler Homepage: https://www.openeuler.org/en/
-rw-r--r--README.md2
-rw-r--r--cloudinit/config/cc_ntp.py4
-rw-r--r--cloudinit/config/cc_yum_add_repo.py4
-rwxr-xr-xcloudinit/distros/__init__.py2
-rw-r--r--cloudinit/distros/openEuler.py9
-rw-r--r--cloudinit/net/sysconfig.py2
-rw-r--r--cloudinit/tests/test_util.py17
-rw-r--r--cloudinit/util.py4
-rw-r--r--config/cloud.cfg.tmpl6
-rw-r--r--systemd/cloud-init-generator.tmpl4
-rw-r--r--systemd/cloud-init.service.tmpl4
-rw-r--r--tests/unittests/test_cli.py4
-rw-r--r--tools/.github-cla-signers1
-rwxr-xr-xtools/render-cloudcfg2
14 files changed, 46 insertions, 19 deletions
diff --git a/README.md b/README.md
index b705a065..e96541ef 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ get in contact with that distribution and send them our way!
| Supported OSes | Supported Public Clouds | Supported Private Clouds |
| --- | --- | --- |
-| Alpine Linux<br />ArchLinux<br />Debian<br />DragonFlyBSD<br />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo/EuroLinux/CloudLinux<br />SLES/openSUSE<br />Ubuntu<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | Amazon Web Services<br />Microsoft Azure<br />Google Cloud Platform<br />Oracle Cloud Infrastructure<br />Softlayer<br />Rackspace Public Cloud<br />IBM Cloud<br />DigitalOcean<br />Bigstep<br />Hetzner<br />Joyent<br />CloudSigma<br />Alibaba Cloud<br />OVH<br />OpenNebula<br />Exoscale<br />Scaleway<br />CloudStack<br />AltCloud<br />SmartOS<br />HyperOne<br />Vultr<br />Rootbox<br /> | Bare metal installs<br />OpenStack<br />LXD<br />KVM<br />Metal-as-a-Service (MAAS)<br />VMware<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />|
+| Alpine Linux<br />ArchLinux<br />Debian<br />DragonFlyBSD<br />Fedora<br />FreeBSD<br />Gentoo Linux<br />NetBSD<br />OpenBSD<br />openEuler<br />RHEL/CentOS/AlmaLinux/Rocky/PhotonOS/Virtuozzo/EuroLinux/CloudLinux<br />SLES/openSUSE<br />Ubuntu<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> | Amazon Web Services<br />Microsoft Azure<br />Google Cloud Platform<br />Oracle Cloud Infrastructure<br />Softlayer<br />Rackspace Public Cloud<br />IBM Cloud<br />DigitalOcean<br />Bigstep<br />Hetzner<br />Joyent<br />CloudSigma<br />Alibaba Cloud<br />OVH<br />OpenNebula<br />Exoscale<br />Scaleway<br />CloudStack<br />AltCloud<br />SmartOS<br />HyperOne<br />Vultr<br />Rootbox<br /> | Bare metal installs<br />OpenStack<br />LXD<br />KVM<br />Metal-as-a-Service (MAAS)<br />VMware<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />|
## To start developing cloud-init
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index e2231cbb..f4468c9d 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -25,8 +25,8 @@ frequency = PER_INSTANCE
NTP_CONF = '/etc/ntp.conf'
NR_POOL_SERVERS = 4
distros = ['almalinux', 'alpine', 'centos', 'cloudlinux', 'debian',
- 'eurolinux', 'fedora', 'opensuse', 'photon', 'rhel', 'rocky',
- 'sles', 'ubuntu', 'virtuozzo']
+ 'eurolinux', 'fedora', 'openEuler', 'opensuse', 'photon',
+ 'rhel', 'rocky', 'sles', 'ubuntu', 'virtuozzo']
NTP_CLIENT_CONFIG = {
'chrony': {
diff --git a/cloudinit/config/cc_yum_add_repo.py b/cloudinit/config/cc_yum_add_repo.py
index 899cb082..bcca86cb 100644
--- a/cloudinit/config/cc_yum_add_repo.py
+++ b/cloudinit/config/cc_yum_add_repo.py
@@ -19,7 +19,7 @@ entry, the config entry will be skipped.
**Module frequency:** per always
**Supported distros:** almalinux, centos, cloudlinux, eurolinux, fedora,
- photon, rhel, rocky, virtuozzo
+ openEuler, photon, rhel, rocky, virtuozzo
**Config keys**::
@@ -38,7 +38,7 @@ from configparser import ConfigParser
from cloudinit import util
distros = ['almalinux', 'centos', 'cloudlinux', 'eurolinux', 'fedora',
- 'photon', 'rhel', 'rocky', 'virtuozzo']
+ 'openEuler', 'photon', 'rhel', 'rocky', 'virtuozzo']
def _canonicalize_id(repo_id):
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
index a0526948..63e78591 100755
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
@@ -50,7 +50,7 @@ OSFAMILIES = {
'freebsd': ['freebsd'],
'gentoo': ['gentoo'],
'redhat': ['almalinux', 'amazon', 'centos', 'cloudlinux', 'eurolinux',
- 'fedora', 'photon', 'rhel', 'rocky', 'virtuozzo'],
+ 'fedora', 'openEuler', 'photon', 'rhel', 'rocky', 'virtuozzo'],
'suse': ['opensuse', 'sles'],
}
diff --git a/cloudinit/distros/openEuler.py b/cloudinit/distros/openEuler.py
new file mode 100644
index 00000000..edb3165d
--- /dev/null
+++ b/cloudinit/distros/openEuler.py
@@ -0,0 +1,9 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
+from cloudinit.distros import rhel
+
+
+class Distro(rhel.Distro):
+ pass
+
+# vi: ts=4 expandtab
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index 7b8e4da7..ef4543b4 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -19,7 +19,7 @@ from .network_state import (
LOG = logging.getLogger(__name__)
KNOWN_DISTROS = ['almalinux', 'centos', 'cloudlinux', 'eurolinux', 'fedora',
- 'rhel', 'rocky', 'suse', 'virtuozzo']
+ 'openEuler', 'rhel', 'rocky', 'suse', 'virtuozzo']
NM_CFG_FILE = "/etc/NetworkManager/NetworkManager.conf"
diff --git a/cloudinit/tests/test_util.py b/cloudinit/tests/test_util.py
index f11cfb27..977ad8e0 100644
--- a/cloudinit/tests/test_util.py
+++ b/cloudinit/tests/test_util.py
@@ -200,6 +200,15 @@ OS_RELEASE_CLOUDLINUX_8 = dedent("""\
BUG_REPORT_URL="https://www.cloudlinux.com/support"
""")
+OS_RELEASE_OPENEULER_20 = dedent("""\
+ NAME="openEuler"
+ VERSION="20.03 (LTS-SP2)"
+ ID="openEuler"
+ VERSION_ID="20.03"
+ PRETTY_NAME="openEuler 20.03 (LTS-SP2)"
+ ANSI_COLOR="0;31"
+""")
+
REDHAT_RELEASE_CENTOS_6 = "CentOS release 6.10 (Final)"
REDHAT_RELEASE_CENTOS_7 = "CentOS Linux release 7.5.1804 (Core)"
REDHAT_RELEASE_REDHAT_6 = (
@@ -719,6 +728,14 @@ class TestGetLinuxDistro(CiTestCase):
self.assertEqual(('debian', '9', 'stretch'), dist)
@mock.patch('cloudinit.util.load_file')
+ def test_get_linux_openeuler(self, m_os_release, m_path_exists):
+ """Verify get the correct name and release name on Openeuler."""
+ m_os_release.return_value = OS_RELEASE_OPENEULER_20
+ m_path_exists.side_effect = TestGetLinuxDistro.os_release_exists
+ dist = util.get_linux_distro()
+ self.assertEqual(('openEuler', '20.03', 'LTS-SP2'), dist)
+
+ @mock.patch('cloudinit.util.load_file')
def test_get_linux_opensuse(self, m_os_release, m_path_exists):
"""Verify we get the correct name and machine arch on openSUSE
prior to openSUSE Leap 15.
diff --git a/cloudinit/util.py b/cloudinit/util.py
index 894245bf..9662b30b 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -549,8 +549,8 @@ def system_info():
linux_dist = info['dist'][0].lower()
if linux_dist in (
'almalinux', 'alpine', 'arch', 'centos', 'cloudlinux',
- 'debian', 'eurolinux', 'fedora', 'photon', 'rhel', 'rocky',
- 'suse', 'virtuozzo'):
+ 'debian', 'eurolinux', 'fedora', 'openEuler', 'photon',
+ 'rhel', 'rocky', 'suse', 'virtuozzo'):
var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu'
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
index e5fbc10b..de1d75e5 100644
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
@@ -33,7 +33,7 @@ disable_root: true
{% endif %}
{% if variant in ["almalinux", "alpine", "amazon", "centos", "cloudlinux", "eurolinux",
- "fedora", "rhel", "rocky", "virtuozzo"] %}
+ "fedora", "openEuler", "rhel", "rocky", "virtuozzo"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
{% if variant == "amazon" %}
resize_rootfs: noblock
@@ -174,7 +174,7 @@ cloud_final_modules:
system_info:
# This will affect which distro class gets used
{% if variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "debian",
- "eurolinux", "fedora", "freebsd", "netbsd", "openbsd",
+ "eurolinux", "fedora", "freebsd", "netbsd", "openbsd", "openEuler",
"photon", "rhel", "rocky", "suse", "ubuntu", "virtuozzo"] %}
distro: {{ variant }}
{% elif variant in ["dragonfly"] %}
@@ -229,7 +229,7 @@ system_info:
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
{% elif variant in ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "eurolinux",
- "fedora", "rhel", "rocky", "suse", "virtuozzo"] %}
+ "fedora", "openEuler", "rhel", "rocky", "suse", "virtuozzo"] %}
# Default user name + that default users groups (if added/used)
default_user:
{% if variant == "amazon" %}
diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl
index 7fe009ec..7d1e7256 100644
--- a/systemd/cloud-init-generator.tmpl
+++ b/systemd/cloud-init-generator.tmpl
@@ -83,8 +83,8 @@ default() {
check_for_datasource() {
local ds_rc=""
-{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora", "rhel",
- "rocky", "virtuozzo"] %}
+{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
+ "openEuler", "rhel", "rocky", "virtuozzo"] %}
local dsidentify="/usr/libexec/cloud-init/ds-identify"
{% else %}
local dsidentify="/usr/lib/cloud-init/ds-identify"
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
index 6c3a8f20..de3f3d91 100644
--- a/systemd/cloud-init.service.tmpl
+++ b/systemd/cloud-init.service.tmpl
@@ -12,8 +12,8 @@ After=systemd-networkd-wait-online.service
{% if variant in ["ubuntu", "unknown", "debian"] %}
After=networking.service
{% endif %}
-{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora", "rhel",
- "rocky", "virtuozzo"] %}
+{% if variant in ["almalinux", "centos", "cloudlinux", "eurolinux", "fedora",
+ "openEuler", "rhel", "rocky", "virtuozzo"] %}
After=network.service
After=NetworkManager.service
{% endif %}
diff --git a/tests/unittests/test_cli.py b/tests/unittests/test_cli.py
index b8ae9e47..1459fd9c 100644
--- a/tests/unittests/test_cli.py
+++ b/tests/unittests/test_cli.py
@@ -225,8 +225,8 @@ class TestCLI(test_helpers.FilesystemMockingTestCase):
expected_doc_sections = [
'**Supported distros:** all',
('**Supported distros:** almalinux, alpine, centos, cloudlinux, '
- 'debian, eurolinux, fedora, opensuse, photon, rhel, rocky, '
- 'sles, ubuntu, virtuozzo'),
+ 'debian, eurolinux, fedora, openEuler, opensuse, photon, rhel, '
+ 'rocky, sles, ubuntu, virtuozzo'),
'**Config schema**:\n **resize_rootfs:** (true/false/noblock)',
'**Examples**::\n\n runcmd:\n - [ ls, -l, / ]\n'
]
diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers
index d1939718..fa395553 100644
--- a/tools/.github-cla-signers
+++ b/tools/.github-cla-signers
@@ -68,3 +68,4 @@ Vultaire
WebSpider
xiachen-rh
xnox
+zhuzaifangxuele
diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
index 78a48c30..186d61b7 100755
--- a/tools/render-cloudcfg
+++ b/tools/render-cloudcfg
@@ -5,7 +5,7 @@ import os
import sys
VARIANTS = ["almalinux", "alpine", "amazon", "arch", "centos", "cloudlinux", "debian",
- "eurolinux", "fedora", "freebsd", "netbsd", "openbsd", "photon",
+ "eurolinux", "fedora", "freebsd", "netbsd", "openbsd", "openEuler", "photon",
"rhel", "suse","rocky", "ubuntu", "unknown", "virtuozzo"]