Package init

This commit is contained in:
dogsheng 2019-12-25 15:43:33 +08:00
parent b508cd6d06
commit 98a32c25ab
2 changed files with 53 additions and 47 deletions

View File

@ -1,9 +1,9 @@
From 098429a75ea00df1d8a5670e45df6babfc37f327 Mon Sep 17 00:00:00 2001 From 098429a75ea00df1d8a5670e45df6babfc37f327 Mon Sep 17 00:00:00 2001
From: chengquan <chengquan3@huawei.com> From: chengquan <chengquan3@huawei.com>
Date: Thu, 8 Aug 2019 16:11:58 +0800 Date: Thu, 8 Aug 2019 16:11:58 +0800
Subject: [PATCH] cloud-init: cloud-init add euleros os Subject: [PATCH] cloud-init: cloud-init add openEuler os
reason: add euleros into distros reason: add openEuler into distros
Signed-off-by: chengquan <chengquan3@huawei.com> Signed-off-by: chengquan <chengquan3@huawei.com>
--- ---
@ -14,7 +14,7 @@ Signed-off-by: chengquan <chengquan3@huawei.com>
cloud-init-17.1/cloudinit/config/cc_spacewalk.py | 2 +- cloud-init-17.1/cloudinit/config/cc_spacewalk.py | 2 +-
.../cloudinit/config/cc_yum_add_repo.py | 2 +- .../cloudinit/config/cc_yum_add_repo.py | 2 +-
cloud-init-17.1/cloudinit/distros/__init__.py | 2 +- cloud-init-17.1/cloudinit/distros/__init__.py | 2 +-
cloud-init-17.1/cloudinit/distros/euleros.py | 12 ++++ cloud-init-17.1/cloudinit/distros/openEuler.py | 12 ++++
cloud-init-17.1/cloudinit/util.py | 2 +- cloud-init-17.1/cloudinit/util.py | 2 +-
cloud-init-17.1/config/cloud.cfg.tmpl | 8 +-- cloud-init-17.1/config/cloud.cfg.tmpl | 8 +--
cloud-init-17.1/systemd/cloud-init.service.tmpl | 2 +- cloud-init-17.1/systemd/cloud-init.service.tmpl | 2 +-
@ -22,7 +22,7 @@ Signed-off-by: chengquan <chengquan3@huawei.com>
.../unittests/test_handler/test_handler_ntp.py | 2 +- .../unittests/test_handler/test_handler_ntp.py | 2 +-
cloud-init-17.1/tools/render-cloudcfg | 2 +- cloud-init-17.1/tools/render-cloudcfg | 2 +-
14 files changed, 95 insertions(+), 15 deletions(-) 14 files changed, 95 insertions(+), 15 deletions(-)
create mode 100644 cloud-init-17.1/cloudinit/distros/euleros.py create mode 100644 cloud-init-17.1/cloudinit/distros/openEuler.py
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index d43d060..4f14c10 100644 index d43d060..4f14c10 100644
@ -33,7 +33,7 @@ index d43d060..4f14c10 100644
TIMESYNCD_CONF = '/etc/systemd/timesyncd.conf.d/cloud-init.conf' TIMESYNCD_CONF = '/etc/systemd/timesyncd.conf.d/cloud-init.conf'
NR_POOL_SERVERS = 4 NR_POOL_SERVERS = 4
-distros = ['centos', 'debian', 'fedora', 'opensuse', 'ubuntu'] -distros = ['centos', 'debian', 'fedora', 'opensuse', 'ubuntu']
+distros = ['centos', 'debian', 'fedora', 'opensuse', 'ubuntu', 'euleros'] +distros = ['centos', 'debian', 'fedora', 'opensuse', 'ubuntu', 'openEuler']
# The schema definition for each cloud-config module is a strict contract for # The schema definition for each cloud-config module is a strict contract for
@ -46,7 +46,7 @@ index 9812562..973fe2e 100644
frequency = PER_INSTANCE frequency = PER_INSTANCE
-distros = ['fedora', 'opensuse', 'rhel', 'sles'] -distros = ['fedora', 'opensuse', 'rhel', 'sles']
+distros = ['fedora', 'opensuse', 'rhel', 'sles', 'euleros'] +distros = ['fedora', 'opensuse', 'rhel', 'sles', 'openEuler']
def generate_resolv_conf(template_fn, params, target_fname="/etc/resolv.conf"): def generate_resolv_conf(template_fn, params, target_fname="/etc/resolv.conf"):
@ -59,7 +59,7 @@ index 7f36cf8..23f3a5a 100644
from cloudinit import util from cloudinit import util
-distros = ['fedora', 'rhel'] -distros = ['fedora', 'rhel']
+distros = ['fedora', 'rhel', 'euleros'] +distros = ['fedora', 'rhel', 'openEuler']
def handle(name, cfg, _cloud, log, _args): def handle(name, cfg, _cloud, log, _args):
@ -72,7 +72,7 @@ index 1020e94..63e9d3b 100644
-distros = ['redhat', 'fedora'] -distros = ['redhat', 'fedora']
+distros = ['redhat', 'fedora', 'euleros'] +distros = ['redhat', 'fedora', 'openEuler']
required_packages = ['rhn-setup'] required_packages = ['rhn-setup']
def_ca_cert_path = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" def_ca_cert_path = "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT"
@ -85,7 +85,7 @@ index 6a42f49..9b2d1bd 100644
from cloudinit import util from cloudinit import util
-distros = ['fedora', 'rhel'] -distros = ['fedora', 'rhel']
+distros = ['fedora', 'rhel', 'euleros'] +distros = ['fedora', 'rhel', 'openEuler']
def _canonicalize_id(repo_id): def _canonicalize_id(repo_id):
@ -98,7 +98,7 @@ index d5becd1..f6eb899 100755
OSFAMILIES = { OSFAMILIES = {
'debian': ['debian', 'ubuntu'], 'debian': ['debian', 'ubuntu'],
- 'redhat': ['centos', 'fedora', 'rhel'], - 'redhat': ['centos', 'fedora', 'rhel'],
+ 'redhat': ['centos', 'fedora', 'rhel', 'euleros'], + 'redhat': ['centos', 'fedora', 'rhel', 'openEuler'],
'gentoo': ['gentoo'], 'gentoo': ['gentoo'],
'freebsd': ['freebsd'], 'freebsd': ['freebsd'],
'suse': ['opensuse', 'sles'], 'suse': ['opensuse', 'sles'],
@ -111,7 +111,7 @@ index e1290aa..d85daf0 100644
if system == "linux": if system == "linux":
linux_dist = info['dist'][0].lower() linux_dist = info['dist'][0].lower()
- if linux_dist in ('centos', 'fedora', 'debian'): - if linux_dist in ('centos', 'fedora', 'debian'):
+ if linux_dist in ('centos', 'fedora', 'debian', 'euleros'): + if linux_dist in ('centos', 'fedora', 'debian', 'openEuler'):
var = linux_dist var = linux_dist
elif linux_dist in ('ubuntu', 'linuxmint', 'mint'): elif linux_dist in ('ubuntu', 'linuxmint', 'mint'):
var = 'ubuntu' var = 'ubuntu'
@ -124,7 +124,7 @@ index 50e3bd8..e3816f2 100644
{% endif %} {% endif %}
-{% if variant in ["centos", "fedora", "rhel"] %} -{% if variant in ["centos", "fedora", "rhel"] %}
+{% if variant in ["centos", "fedora", "rhel", "euleros"] %} +{% if variant in ["centos", "fedora", "rhel", "openEuler"] %}
mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2'] mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
resize_rootfs_tmp: /dev resize_rootfs_tmp: /dev
ssh_deletekeys: 0 ssh_deletekeys: 0
@ -133,7 +133,7 @@ index 50e3bd8..e3816f2 100644
- locale - locale
- set-passwords - set-passwords
-{% if variant in ["rhel", "fedora"] %} -{% if variant in ["rhel", "fedora"] %}
+{% if variant in ["rhel", "fedora", "euleros"] %} +{% if variant in ["rhel", "fedora", "openEuler"] %}
- spacewalk - spacewalk
- yum-add-repo - yum-add-repo
{% endif %} {% endif %}
@ -142,7 +142,7 @@ index 50e3bd8..e3816f2 100644
system_info: system_info:
# This will affect which distro class gets used # This will affect which distro class gets used
-{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd"] %} -{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd"] %}
+{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd", "euleros"] %} +{% if variant in ["centos", "debian", "fedora", "rhel", "suse", "ubuntu", "freebsd", "openEuler"] %}
distro: {{ variant }} distro: {{ variant }}
{% else %} {% else %}
# Unknown/fallback distro. # Unknown/fallback distro.
@ -151,7 +151,7 @@ index 50e3bd8..e3816f2 100644
security: http://ports.ubuntu.com/ubuntu-ports security: http://ports.ubuntu.com/ubuntu-ports
ssh_svcname: ssh ssh_svcname: ssh
-{% elif variant in ["centos", "rhel", "fedora", "suse"] %} -{% elif variant in ["centos", "rhel", "fedora", "suse"] %}
+{% elif variant in ["centos", "rhel", "fedora", "suse", "euleros"] %} +{% elif variant in ["centos", "rhel", "fedora", "suse", "openEuler"] %}
# Default user name + that default users groups (if added/used) # Default user name + that default users groups (if added/used)
default_user: default_user:
name: {{ variant }} name: {{ variant }}
@ -164,7 +164,7 @@ index b92e8ab..f59d4fd 100644
After=networking.service After=networking.service
{% endif %} {% endif %}
-{% if variant in ["centos", "fedora", "redhat"] %} -{% if variant in ["centos", "fedora", "redhat"] %}
+{% if variant in ["centos", "fedora", "redhat", "euleros"] %} +{% if variant in ["centos", "fedora", "redhat", "openEuler"] %}
After=network.service After=network.service
{% endif %} {% endif %}
{% if variant in ["suse"] %} {% if variant in ["suse"] %}
@ -177,7 +177,7 @@ index 4357fbb..7d3034d 100644
OS_FAMILY_MAPPING = { OS_FAMILY_MAPPING = {
'debian': ['debian', 'ubuntu'], 'debian': ['debian', 'ubuntu'],
- 'redhat': ['centos', 'rhel', 'fedora'], - 'redhat': ['centos', 'rhel', 'fedora'],
+ 'redhat': ['centos', 'rhel', 'fedora', 'euleros'], + 'redhat': ['centos', 'rhel', 'fedora', 'openEuler'],
'gentoo': ['gentoo'], 'gentoo': ['gentoo'],
'freebsd': ['freebsd'], 'freebsd': ['freebsd'],
'suse': ['sles'], 'suse': ['sles'],
@ -190,7 +190,7 @@ index 3abe578..78548cc 100644
} }
ntp_conf = self.tmp_path('ntp.conf', self.new_root) # Doesn't exist ntp_conf = self.tmp_path('ntp.conf', self.new_root) # Doesn't exist
- for distro in ('debian', 'ubuntu', 'fedora', 'rhel', 'sles'): - for distro in ('debian', 'ubuntu', 'fedora', 'rhel', 'sles'):
+ for distro in ('debian', 'ubuntu', 'fedora', 'rhel', 'sles', 'euleros'): + for distro in ('debian', 'ubuntu', 'fedora', 'rhel', 'sles', 'openEuler'):
mycloud = self._get_cloud(distro) mycloud = self._get_cloud(distro)
root_dir = dirname(dirname(os.path.realpath(util.__file__))) root_dir = dirname(dirname(os.path.realpath(util.__file__)))
tmpl_file = os.path.join( tmpl_file = os.path.join(
@ -203,15 +203,15 @@ index 91d074b..7a8a2c4 100755
import sys import sys
-VARIANTS = ["bsd", "centos", "fedora", "rhel", "suse", "ubuntu", "unknown"] -VARIANTS = ["bsd", "centos", "fedora", "rhel", "suse", "ubuntu", "unknown"]
+VARIANTS = ["bsd", "centos", "fedora", "rhel", "suse", "ubuntu", "unknown", "euleros"] +VARIANTS = ["bsd", "centos", "fedora", "rhel", "suse", "ubuntu", "unknown", "openEuler"]
if "avoid-pep8-E402-import-not-top-of-file": if "avoid-pep8-E402-import-not-top-of-file":
_tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) _tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
diff --git a/cloudinit/distros/euleros.py b/cloudinit/distros/euleros.py diff --git a/cloudinit/distros/openEuler.py b/cloudinit/distros/openEuler.py
new file mode 100644 new file mode 100644
index 0000000..5ac4700 index 0000000..5ac4700
--- /dev/null --- /dev/null
+++ b/cloudinit/distros/euleros.py +++ b/cloudinit/distros/openEuler.py
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
+# Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved. +# Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
+# This file is part of cloud-init. See LICENSE file for license information. +# This file is part of cloud-init. See LICENSE file for license information.

View File

@ -1,6 +1,6 @@
Name: cloud-init Name: cloud-init
Version: 17.1 Version: 17.1
Release: 10 Release: 11
Summary: the defacto multi-distribution package that handles early initialization of a cloud instance. Summary: the defacto multi-distribution package that handles early initialization of a cloud instance.
License: ASL 2.0 or GPLv3 License: ASL 2.0 or GPLv3
URL: http://launchpad.net/cloud-init URL: http://launchpad.net/cloud-init
@ -21,7 +21,7 @@ Patch6005: Fix-ssh-keys-validation-in-ssh_util.patch
Patch6006: stages-fix-tracebacks-if-a-module-stage-is-undefined.patch Patch6006: stages-fix-tracebacks-if-a-module-stage-is-undefined.patch
Patch6007: stages-Fix-bug-causing-datasource-to-have-incorrect-.patch Patch6007: stages-Fix-bug-causing-datasource-to-have-incorrect-.patch
Patch9000: bugfix-cloud-init-add-euleros-os.patch Patch9000: bugfix-cloud-init-add-openEuler-os.patch
Patch9001: bugfix-sort-requirements.patch Patch9001: bugfix-sort-requirements.patch
Patch9002: add-variable-to-forbid-tmp-dir.patch Patch9002: add-variable-to-forbid-tmp-dir.patch
@ -58,15 +58,15 @@ sed -i 's/\/etc\/redhat-release/\/etc\/%{_vendor}-release/g' setup.py
%install %install
%py3_install -- --init-system=systemd %py3_install -- --init-system=systemd
python3 tools/render-cloudcfg --variant euleros > %{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}/var/lib/cloud
install -d %{buildroot}/run/%{name} install -d %{buildroot}/run/%{name}
install -D -m 0644 %{SOURCE1} %{buildroot}/%{_tmpfilesdir}/%{name}.conf install -D -m 0644 %{SOURCE1} %{buildroot}/%{_tmpfilesdir}/%{name}.conf
install -D -m 0644 tools/21-cloudinit.conf %{buildroot}/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf install -D -m 0644 tools/21-cloudinit.conf %{buildroot}/%{_sysconfdir}/rsyslog.d/21-cloudinit.conf
%check %check
#remove test_handler_ntp.py
rm -f $RPM_BUILD_DIR/%{name}-%{version}/tests/unittests/test_handler/test_handler_ntp.py rm -f $RPM_BUILD_DIR/%{name}-%{version}/tests/unittests/test_handler/test_handler_ntp.py
rm -f $RPM_BUILD_DIR/%{name}-%{version}/tests/unittests/test_datasource/test_opennebula.py
nosetests-%{python3_version} tests/unittests/ nosetests-%{python3_version} tests/unittests/
@ -128,6 +128,12 @@ fi
%exclude /usr/share/doc/* %exclude /usr/share/doc/*
%changelog %changelog
* Mon Dec 23 2019 chengquan <chengquan3@huawei.com> - 17.1-11
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:add openEuler into distros
* Thu Oct 31 2019 chengquan <chengquan3@huawei.com> - 17.1-10 * Thu Oct 31 2019 chengquan <chengquan3@huawei.com> - 17.1-10
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA