!61 添加的openEuler字样和实际获取的linux_dist值不一样,需修改。

From: @yang_zhuang_zhuang
Reviewed-by: @overweight
Signed-off-by: @overweight
This commit is contained in:
openeuler-ci-bot 2021-12-06 07:18:30 +00:00 committed by Gitee
commit 15b4938e70
3 changed files with 47 additions and 24 deletions

View File

@ -21,7 +21,7 @@ index 0a5d481..17ba3c5 100644
LOG = logging.getLogger(__name__)
NM_CFG_FILE = "/etc/NetworkManager/NetworkManager.conf"
-KNOWN_DISTROS = ['centos', 'fedora', 'rhel', 'suse']
+KNOWN_DISTROS = ['centos', 'fedora', 'rhel', 'suse', 'linux']
+KNOWN_DISTROS = ['centos', 'fedora', 'rhel', 'suse', 'openeuler']
def _make_header(sep='#'):

View File

@ -1,9 +1,9 @@
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
Subject: [PATCH] cloud-init: cloud-init add openeuler os
reason: add openEuler into distros
reason: add openeuler into distros
Signed-off-by: chengquan <chengquan3@huawei.com>
---
@ -14,14 +14,15 @@ Signed-off-by: chengquan <chengquan3@huawei.com>
cloud-init-20.3/cloudinit/config/cc_spacewalk.py | 2 +-
.../cloudinit/config/cc_yum_add_repo.py | 2 +-
cloud-init-20.3/cloudinit/distros/__init__.py | 2 +-
cloud-init-20.3/cloudinit/distros/openEuler.py | 12 ++++
cloud-init-20.3/cloudinit/distros/openeuler.py | 12 ++++
cloud-init-20.3/cloudinit/util.py | 2 +-
cloud-init-20.3/config/cloud.cfg.tmpl | 8 +--
cloud-init-20.3/systemd/cloud-init.service.tmpl | 2 +-
cloud-init-20.3/tests/cloud_tests/util.py | 2 +-
cloud-init-20.3/tools/render-cloudcfg | 2 +-
14 files changed, 95 insertions(+), 15 deletions(-)
create mode 100644 cloud-init-19.4/cloudinit/distros/openEuler.py
cloud-init-20.3/systemd/cloud-init-generator.tmpl | 2 +-
15 files changed, 96 insertions(+), 16 deletions(-)
create mode 100644 cloud-init-19.4/cloudinit/distros/openeuler.py
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index 3d7279d..ae6f06b 100644
@ -32,7 +33,7 @@ index 3d7279d..ae6f06b 100644
NR_POOL_SERVERS = 4
distros = ['alpine', 'centos', 'debian', 'fedora', 'opensuse', 'rhel',
- 'sles', 'ubuntu']
+ 'sles', 'ubuntu', 'openEuler']
+ 'sles', 'ubuntu', 'openeuler']
NTP_CLIENT_CONFIG = {
'chrony': {
@ -45,7 +46,7 @@ index 519e66e..dc093fb 100644
frequency = PER_INSTANCE
-distros = ['alpine', 'fedora', 'opensuse', 'rhel', 'sles']
+distros = ['alpine', 'fedora', 'opensuse', 'rhel', 'sles', 'openEuler']
+distros = ['alpine', 'fedora', 'opensuse', 'rhel', 'sles', 'openeuler']
def generate_resolv_conf(template_fn, params, target_fname="/etc/resolv.conf"):
@ -58,7 +59,7 @@ index 28d62e9..9a25767 100644
LOG = logging.getLogger(__name__)
-distros = ['fedora', 'rhel']
+distros = ['fedora', 'rhel', 'openEuler']
+distros = ['fedora', 'rhel', 'openeuler']
def handle(name, cfg, _cloud, log, _args):
@ -71,7 +72,7 @@ index 9508360..0cee8a7 100644
-distros = ['redhat', 'fedora']
+distros = ['redhat', 'fedora', 'openEuler']
+distros = ['redhat', 'fedora', 'openeuler']
required_packages = ['rhn-setup']
def_ca_cert_path = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
@ -84,7 +85,7 @@ index 01fe683..1b7c783 100644
from cloudinit import util
-distros = ['centos', 'fedora', 'rhel']
+distros = ['centos', 'fedora', 'rhel', 'openEuler']
+distros = ['centos', 'fedora', 'rhel', 'openeuler']
def _canonicalize_id(repo_id):
@ -97,15 +98,15 @@ index 2537608..2492962 100755
'freebsd': ['freebsd'],
'gentoo': ['gentoo'],
- 'redhat': ['amazon', 'centos', 'fedora', 'rhel'],
+ 'redhat': ['amazon', 'centos', 'fedora', 'rhel', 'openEuler'],
+ 'redhat': ['amazon', 'centos', 'fedora', 'rhel', 'openeuler'],
'suse': ['opensuse', 'sles'],
}
diff --git a/cloudinit/distros/openEuler.py b/cloudinit/distros/openEuler.py
diff --git a/cloudinit/distros/openeuler.py b/cloudinit/distros/openeuler.py
new file mode 100644
index 0000000..7505ca4
--- /dev/null
+++ b/cloudinit/distros/openEuler.py
+++ b/cloudinit/distros/openeuler.py
@@ -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.
@ -128,7 +129,7 @@ index cf9e349..39a6c50 100644
if linux_dist in (
'alpine', 'arch', 'centos', 'debian', 'fedora', 'rhel',
- 'suse'):
+ 'suse', 'openEuler'):
+ 'suse', 'openeuler'):
var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu'
@ -141,7 +142,7 @@ index 2beb9b0..2318741 100644
{% endif %}
-{% if variant in ["alpine", "amazon", "centos", "fedora", "rhel"] %}
+{% if variant in ["alpine", "amazon", "centos", "fedora", "rhel", "openEuler"] %}
+{% if variant in ["alpine", "amazon", "centos", "fedora", "rhel", "openeuler"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
{% if variant == "amazon" %}
resize_rootfs: noblock
@ -150,7 +151,7 @@ index 2beb9b0..2318741 100644
- locale
- set-passwords
-{% if variant in ["rhel", "fedora"] %}
+{% if variant in ["rhel", "fedora", "openEuler"] %}
+{% if variant in ["rhel", "fedora", "openeuler"] %}
- spacewalk
- yum-add-repo
{% endif %}
@ -159,7 +160,7 @@ index 2beb9b0..2318741 100644
{% if variant in ["alpine", "amazon", "arch", "centos", "debian",
"fedora", "freebsd", "netbsd", "openbsd", "rhel",
- "suse", "ubuntu"] %}
+ "suse", "ubuntu", "openEuler"] %}
+ "suse", "ubuntu", "openeuler"] %}
distro: {{ variant }}
{% else %}
# Unknown/fallback distro.
@ -168,7 +169,7 @@ index 2beb9b0..2318741 100644
ssh_svcname: ssh
{% elif variant in ["alpine", "amazon", "arch", "centos", "fedora",
- "rhel", "suse"] %}
+ "rhel", "suse", "openEuler"] %}
+ "rhel", "suse", "openeuler"] %}
# Default user name + that default users groups (if added/used)
default_user:
{% if variant == "amazon" %}
@ -181,7 +182,7 @@ index af6d9a8..fd1babf 100644
After=networking.service
{% endif %}
-{% if variant in ["centos", "fedora", "rhel"] %}
+{% if variant in ["centos", "fedora", "rhel", "openEuler"] %}
+{% if variant in ["centos", "fedora", "rhel", "openeuler"] %}
After=network.service
After=NetworkManager.service
{% endif %}
@ -194,7 +195,7 @@ index 7dcccbd..87f0e3f 100644
OS_FAMILY_MAPPING = {
'debian': ['debian', 'ubuntu'],
- 'redhat': ['centos', 'rhel', 'fedora'],
+ 'redhat': ['centos', 'rhel', 'fedora', 'openEuler'],
+ 'redhat': ['centos', 'rhel', 'fedora', 'openeuler'],
'gentoo': ['gentoo'],
'freebsd': ['freebsd'],
'suse': ['sles'],
@ -207,7 +208,23 @@ index ed45484..6d1fa6e 100755
VARIANTS = ["alpine", "amazon", "arch", "centos", "debian", "fedora",
"freebsd", "netbsd", "openbsd", "rhel", "suse", "ubuntu",
- "unknown"]
+ "unknown", "openEuler"]
+ "unknown", "openeuler"]
if "avoid-pep8-E402-import-not-top-of-file":
diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl
index 0773356..43c0452 100755
--- a/systemd/cloud-init-generator.tmpl
+++ b/systemd/cloud-init-generator.tmpl
@@ -83,7 +83,7 @@ default() {
check_for_datasource() {
local ds_rc=""
-{% if variant in ["rhel", "fedora", "centos"] %}
+{% if variant in ["rhel", "fedora", "centos", "openeuler"] %}
local dsidentify="/usr/libexec/cloud-init/ds-identify"
{% else %}
local dsidentify="/usr/lib/cloud-init/ds-identify"
--
1.8.3.1

View File

@ -1,6 +1,6 @@
Name: cloud-init
Version: 20.4
Release: 3
Release: 4
Summary: the defacto multi-distribution package that handles early initialization of a cloud instance.
License: ASL 2.0 or GPLv3
URL: http://launchpad.net/cloud-init
@ -54,7 +54,7 @@ sed -i 's/\/etc\/redhat-release/\/etc\/%{_vendor}-release/g' setup.py
%install
%py3_install -- --init-system=systemd
python3 tools/render-cloudcfg --variant openEuler > %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg
python3 tools/render-cloudcfg --variant openeuler > %{buildroot}/%{_sysconfdir}/cloud/cloud.cfg
install -d %{buildroot}/var/lib/cloud
install -d %{buildroot}/run/%{name}
install -D -m 0644 %{SOURCE1} %{buildroot}/%{_tmpfilesdir}/%{name}.conf
@ -126,6 +126,12 @@ fi
%exclude /usr/share/doc/*
%changelog
* Sat Dec 4 2021 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 20.4-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:change openEuler to openeuler
* Wed Sep 22 2021 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 20.4-3
- Type:CVE
- ID:CVE-2021-3429