cloud-init/bugfix-cloud-init-add-openEuler-os.patch

214 lines
7.7 KiB
Diff
Raw Normal View History

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>
---
.../0001-cloud-init-Update-patch-information.patch | 68 ++++++++++++++++++++++
2020-11-04 10:20:14 +08:00
cloud-init-20.3/cloudinit/config/cc_ntp.py | 2 +-
cloud-init-20.3/cloudinit/config/cc_resolv_conf.py | 2 +-
cloud-init-20.3/cloudinit/config/cc_rh_subscription.py | 2 +-
cloud-init-20.3/cloudinit/config/cc_spacewalk.py | 2 +-
2020-07-31 15:06:51 +08:00
.../cloudinit/config/cc_yum_add_repo.py | 2 +-
2020-11-04 10:20:14 +08:00
cloud-init-20.3/cloudinit/distros/__init__.py | 2 +-
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 +-
2020-07-31 15:06:51 +08:00
14 files changed, 95 insertions(+), 15 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
2020-11-04 10:20:14 +08:00
index 3d7279d..ae6f06b 100644
2020-07-31 15:06:51 +08:00
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
2020-11-04 10:20:14 +08:00
@@ -25,7 +25,7 @@ frequency = PER_INSTANCE
2020-07-31 15:06:51 +08:00
NTP_CONF = '/etc/ntp.conf'
NR_POOL_SERVERS = 4
2020-11-04 10:20:14 +08:00
distros = ['alpine', 'centos', 'debian', 'fedora', 'opensuse', 'rhel',
- 'sles', 'ubuntu']
+ 'sles', 'ubuntu', 'openEuler']
2020-07-31 15:06:51 +08:00
NTP_CLIENT_CONFIG = {
'chrony': {
diff --git a/cloudinit/config/cc_resolv_conf.py b/cloudinit/config/cc_resolv_conf.py
2020-11-04 10:20:14 +08:00
index 519e66e..dc093fb 100644
2020-07-31 15:06:51 +08:00
--- a/cloudinit/config/cc_resolv_conf.py
+++ b/cloudinit/config/cc_resolv_conf.py
@@ -55,7 +55,7 @@ LOG = logging.getLogger(__name__)
2020-11-04 10:20:14 +08:00
2020-07-31 15:06:51 +08:00
frequency = PER_INSTANCE
2020-11-04 10:20:14 +08:00
-distros = ['alpine', 'fedora', 'opensuse', 'rhel', 'sles']
+distros = ['alpine', 'fedora', 'opensuse', 'rhel', 'sles', 'openEuler']
2020-07-31 15:06:51 +08:00
def generate_resolv_conf(template_fn, params, target_fname="/etc/resolv.conf"):
diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py
2020-11-04 10:20:14 +08:00
index 28d62e9..9a25767 100644
2020-07-31 15:06:51 +08:00
--- a/cloudinit/config/cc_rh_subscription.py
+++ b/cloudinit/config/cc_rh_subscription.py
2020-11-04 10:20:14 +08:00
@@ -44,7 +44,7 @@ from cloudinit import util
2020-07-31 15:06:51 +08:00
LOG = logging.getLogger(__name__)
-distros = ['fedora', 'rhel']
+distros = ['fedora', 'rhel', 'openEuler']
def handle(name, cfg, _cloud, log, _args):
diff --git a/cloudinit/config/cc_spacewalk.py b/cloudinit/config/cc_spacewalk.py
2020-11-04 10:20:14 +08:00
index 9508360..0cee8a7 100644
2020-07-31 15:06:51 +08:00
--- a/cloudinit/config/cc_spacewalk.py
+++ b/cloudinit/config/cc_spacewalk.py
@@ -30,7 +30,7 @@ For more information about spacewalk see: https://fedorahosted.org/spacewalk/
2020-11-04 10:20:14 +08:00
from cloudinit import subp
2020-07-31 15:06:51 +08:00
-distros = ['redhat', 'fedora']
+distros = ['redhat', 'fedora', 'openEuler']
required_packages = ['rhn-setup']
def_ca_cert_path = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
2020-11-04 10:20:14 +08:00
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
2020-11-04 10:20:14 +08:00
index 01fe683..1b7c783 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
2020-11-04 10:20:14 +08:00
@@ -36,7 +36,7 @@ from configparser import ConfigParser
2020-07-31 15:06:51 +08:00
from cloudinit import util
2020-11-04 10:20:14 +08:00
-distros = ['centos', 'fedora', 'rhel']
+distros = ['centos', 'fedora', 'rhel', 'openEuler']
2020-07-31 15:06:51 +08:00
def _canonicalize_id(repo_id):
diff --git a/cloudinit/distros/__init__.py b/cloudinit/distros/__init__.py
2020-11-04 10:20:14 +08:00
index 2537608..2492962 100755
2020-07-31 15:06:51 +08:00
--- a/cloudinit/distros/__init__.py
+++ b/cloudinit/distros/__init__.py
2020-11-04 10:20:14 +08:00
@@ -45,7 +45,7 @@ OSFAMILIES = {
2020-07-31 15:06:51 +08:00
'debian': ['debian', 'ubuntu'],
2020-11-04 10:20:14 +08:00
'freebsd': ['freebsd'],
'gentoo': ['gentoo'],
2020-07-31 15:06:51 +08:00
- 'redhat': ['amazon', 'centos', 'fedora', 'rhel'],
+ 'redhat': ['amazon', 'centos', 'fedora', 'rhel', 'openEuler'],
'suse': ['opensuse', 'sles'],
2020-11-04 10:20:14 +08:00
}
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
@@ -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/cloudinit/util.py b/cloudinit/util.py
2020-11-04 10:20:14 +08:00
index cf9e349..39a6c50 100644
2020-07-31 15:06:51 +08:00
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
2020-11-04 10:20:14 +08:00
@@ -549,7 +549,7 @@ def system_info():
2020-07-31 15:06:51 +08:00
linux_dist = info['dist'][0].lower()
if linux_dist in (
2020-11-04 10:20:14 +08:00
'alpine', 'arch', 'centos', 'debian', 'fedora', 'rhel',
- 'suse'):
+ 'suse', 'openEuler'):
2020-07-31 15:06:51 +08:00
var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu'
diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
2020-11-04 10:20:14 +08:00
index 2beb9b0..2318741 100644
2020-07-31 15:06:51 +08:00
--- a/config/cloud.cfg.tmpl
+++ b/config/cloud.cfg.tmpl
2020-11-04 10:20:14 +08:00
@@ -21,7 +21,7 @@ disable_root: false
2020-07-31 15:06:51 +08:00
disable_root: true
{% endif %}
2020-11-04 10:20:14 +08:00
-{% if variant in ["alpine", "amazon", "centos", "fedora", "rhel"] %}
+{% if variant in ["alpine", "amazon", "centos", "fedora", "rhel", "openEuler"] %}
2020-07-31 15:06:51 +08:00
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
2020-11-04 10:20:14 +08:00
{% if variant == "amazon" %}
resize_rootfs: noblock
@@ -92,7 +92,7 @@ cloud_config_modules:
2020-07-31 15:06:51 +08:00
- ssh-import-id
- locale
- set-passwords
-{% if variant in ["rhel", "fedora"] %}
+{% if variant in ["rhel", "fedora", "openEuler"] %}
- spacewalk
- yum-add-repo
{% endif %}
2020-11-04 10:20:14 +08:00
@@ -153,7 +153,7 @@ system_info:
2020-07-31 15:06:51 +08:00
# This will affect which distro class gets used
2020-11-04 10:20:14 +08:00
{% if variant in ["alpine", "amazon", "arch", "centos", "debian",
"fedora", "freebsd", "netbsd", "openbsd", "rhel",
- "suse", "ubuntu"] %}
+ "suse", "ubuntu", "openEuler"] %}
2020-07-31 15:06:51 +08:00
distro: {{ variant }}
{% else %}
# Unknown/fallback distro.
2020-11-04 10:20:14 +08:00
@@ -205,7 +205,7 @@ system_info:
2020-07-31 15:06:51 +08:00
security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh
2020-11-04 10:20:14 +08:00
{% elif variant in ["alpine", "amazon", "arch", "centos", "fedora",
- "rhel", "suse"] %}
+ "rhel", "suse", "openEuler"] %}
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" %}
2020-07-31 15:06:51 +08:00
diff --git a/systemd/cloud-init.service.tmpl b/systemd/cloud-init.service.tmpl
2020-11-04 10:20:14 +08:00
index af6d9a8..fd1babf 100644
2020-07-31 15:06:51 +08:00
--- a/systemd/cloud-init.service.tmpl
+++ b/systemd/cloud-init.service.tmpl
@@ -10,7 +10,7 @@ After=systemd-networkd-wait-online.service
{% if variant in ["ubuntu", "unknown", "debian"] %}
After=networking.service
{% endif %}
2020-11-04 10:20:14 +08:00
-{% if variant in ["centos", "fedora", "rhel"] %}
+{% if variant in ["centos", "fedora", "rhel", "openEuler"] %}
2020-07-31 15:06:51 +08:00
After=network.service
After=NetworkManager.service
{% endif %}
diff --git a/tests/cloud_tests/util.py b/tests/cloud_tests/util.py
2020-11-04 10:20:14 +08:00
index 7dcccbd..87f0e3f 100644
2020-07-31 15:06:51 +08:00
--- a/tests/cloud_tests/util.py
+++ b/tests/cloud_tests/util.py
2020-11-04 10:20:14 +08:00
@@ -23,7 +23,7 @@ from tests.cloud_tests import LOG
2020-07-31 15:06:51 +08:00
OS_FAMILY_MAPPING = {
'debian': ['debian', 'ubuntu'],
- 'redhat': ['centos', 'rhel', 'fedora'],
+ 'redhat': ['centos', 'rhel', 'fedora', 'openEuler'],
'gentoo': ['gentoo'],
'freebsd': ['freebsd'],
'suse': ['sles'],
diff --git a/tools/render-cloudcfg b/tools/render-cloudcfg
2020-11-04 10:20:14 +08:00
index ed45484..6d1fa6e 100755
2020-07-31 15:06:51 +08:00
--- a/tools/render-cloudcfg
+++ b/tools/render-cloudcfg
2020-11-04 10:20:14 +08:00
@@ -6,7 +6,7 @@ import sys
VARIANTS = ["alpine", "amazon", "arch", "centos", "debian", "fedora",
"freebsd", "netbsd", "openbsd", "rhel", "suse", "ubuntu",
- "unknown"]
+ "unknown", "openEuler"]
2020-07-31 15:06:51 +08:00
if "avoid-pep8-E402-import-not-top-of-file":