!60 添加的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:25 +00:00 committed by Gitee
commit ed12bee720
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-19.4/cloudinit/config/cc_spacewalk.py | 2 +-
.../cloudinit/config/cc_yum_add_repo.py | 2 +-
cloud-init-19.4/cloudinit/distros/__init__.py | 2 +-
cloud-init-19.4/cloudinit/distros/openEuler.py | 12 ++++
cloud-init-19.4/cloudinit/distros/openeuler.py | 12 ++++
cloud-init-19.4/cloudinit/util.py | 2 +-
cloud-init-19.4/config/cloud.cfg.tmpl | 8 +--
cloud-init-19.4/systemd/cloud-init.service.tmpl | 2 +-
cloud-init-19.4/tests/cloud_tests/util.py | 2 +-
cloud-init-19.4/tools/render-cloudcfg | 2 +-
14 files changed, 95 insertions(+), 15 deletions(-)
create mode 100644 cloud-init-19.4/cloudinit/distros/openEuler.py
cloud-init-19.4/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 d43d060..4f14c10 100644
@ -32,7 +33,7 @@ index d43d060..4f14c10 100644
NTP_CONF = '/etc/ntp.conf'
NR_POOL_SERVERS = 4
-distros = ['centos', 'debian', 'fedora', 'opensuse', 'rhel', 'sles', 'ubuntu']
+distros = ['centos', 'debian', 'fedora', 'opensuse', 'rhel', 'sles', 'ubuntu', 'openEuler']
+distros = ['centos', 'debian', 'fedora', 'opensuse', 'rhel', 'sles', 'ubuntu', 'openeuler']
NTP_CLIENT_CONFIG = {
'chrony': {
@ -45,7 +46,7 @@ index 9812562..973fe2e 100644
frequency = PER_INSTANCE
-distros = ['fedora', 'opensuse', 'rhel', 'sles']
+distros = ['fedora', 'opensuse', 'rhel', 'sles', 'openEuler']
+distros = ['fedora', 'opensuse', 'rhel', 'sles', 'openeuler']
def generate_resolv_conf(template_fn, params, target_fname="/etc/resolv.conf"):
@ -58,7 +59,7 @@ index 7f36cf8..23f3a5a 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 1020e94..63e9d3b 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 6a42f49..9b2d1bd 100644
from cloudinit import util
-distros = ['fedora', 'rhel']
+distros = ['fedora', 'rhel', 'openEuler']
+distros = ['fedora', 'rhel', 'openeuler']
def _canonicalize_id(repo_id):
@ -97,7 +98,7 @@ index d5becd1..f6eb899 100755
OSFAMILIES = {
'debian': ['debian', 'ubuntu'],
- 'redhat': ['amazon', 'centos', 'fedora', 'rhel'],
+ 'redhat': ['amazon', 'centos', 'fedora', 'rhel', 'openEuler'],
+ 'redhat': ['amazon', 'centos', 'fedora', 'rhel', 'openeuler'],
'gentoo': ['gentoo'],
'freebsd': ['freebsd'],
'suse': ['opensuse', 'sles'],
@ -110,7 +111,7 @@ index e1290aa..d85daf0 100644
linux_dist = info['dist'][0].lower()
if linux_dist in (
- 'arch', 'centos', 'debian', 'fedora', 'rhel', 'suse'):
+ 'arch', 'centos', 'debian', 'fedora', 'rhel', 'suse', 'openEuler'):
+ 'arch', 'centos', 'debian', 'fedora', 'rhel', 'suse', 'openeuler'):
var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu'
@ -123,7 +124,7 @@ index 50e3bd8..e3816f2 100644
{% endif %}
-{% if variant in ["centos", "fedora", "rhel"] %}
+{% if variant in ["centos", "fedora", "rhel", "openEuler"] %}
+{% if variant in ["centos", "fedora", "rhel", "openeuler"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
resize_rootfs_tmp: /dev
ssh_pwauth: 0
@ -132,7 +133,7 @@ index 50e3bd8..e3816f2 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 %}
@ -141,7 +142,7 @@ index 50e3bd8..e3816f2 100644
system_info:
# This will affect which distro class gets used
-{% if variant in ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse", "ubuntu"] %}
+{% if variant in ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse", "ubuntu", "openEuler"] %}
+{% if variant in ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse", "ubuntu", "openeuler"] %}
distro: {{ variant }}
{% else %}
# Unknown/fallback distro.
@ -150,7 +151,7 @@ index 50e3bd8..e3816f2 100644
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
-{% elif variant in ["arch", "centos", "fedora", "rhel", "suse"] %}
+{% elif variant in ["arch", "centos", "fedora", "rhel", "suse", "openEuler"] %}
+{% elif variant in ["arch", "centos", "fedora", "rhel", "suse", "openeuler"] %}
# Default user name + that default users groups (if added/used)
default_user:
name: {{ variant }}
@ -163,7 +164,7 @@ index b92e8ab..f59d4fd 100644
After=networking.service
{% endif %}
-{% if variant in ["centos", "fedora", "redhat"] %}
+{% if variant in ["centos", "fedora", "redhat", "openEuler"] %}
+{% if variant in ["centos", "fedora", "redhat", "openeuler"] %}
After=network.service
After=NetworkManager.service
{% endif %}
@ -176,7 +177,7 @@ index 4357fbb..7d3034d 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'],
@ -189,15 +190,15 @@ index 91d074b..7a8a2c4 100755
VARIANTS = ["arch", "centos", "debian", "fedora", "freebsd", "rhel", "suse",
- "ubuntu", "unknown"]
+ "ubuntu", "unknown", "openEuler"]
+ "ubuntu", "unknown", "openeuler"]
if "avoid-pep8-E402-import-not-top-of-file":
_tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
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..5ac4700
--- /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.
@ -211,3 +212,19 @@ index 0000000..5ac4700
+ pass
+
+# vi: ts=4 expandtab
diff --git a/systemd/cloud-init-generator.tmpl b/systemd/cloud-init-generator.tmpl
index 45efa24..8bd49cc 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 ["redhat", "fedora", "centos"] %}
+{% if variant in ["redhat", "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: 19.4
Release: 5
Release: 6
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
@ -52,7 +52,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
@ -124,6 +124,12 @@ fi
%exclude /usr/share/doc/*
%changelog
* Sat Dec 4 2021 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 19.4-6
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:change openEuler to openeuler
* Wed Sep 22 2021 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 19.4-5
- Type:CVE
- ID:CVE-2021-3429