!45 Hostname module support openEuler

From: @wk333 
Reviewed-by: @overweight 
Signed-off-by: @overweight
This commit is contained in:
openeuler-ci-bot 2022-03-01 03:31:03 +00:00 committed by Gitee
commit 7a7ca787ce
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 46 additions and 1 deletions

View File

@ -11,10 +11,11 @@
Name: ansible Name: ansible
Summary: SSH-based configuration management, deployment, and task execution system Summary: SSH-based configuration management, deployment, and task execution system
Version: 2.9.27 Version: 2.9.27
Release: 0 Release: 1
License: Python-2.0 and MIT and GPL+ License: Python-2.0 and MIT and GPL+
Url: http://ansible.com Url: http://ansible.com
Source0: https://releases.ansible.com/ansible/%{name}-%{version}.tar.gz Source0: https://releases.ansible.com/ansible/%{name}-%{version}.tar.gz
Patch0: hostname-module-support-openEuler.patch
BuildArch: noarch BuildArch: noarch
Provides: ansible-fireball = %{version}-%{release} Provides: ansible-fireball = %{version}-%{release}
Obsoletes: ansible-fireball < 1.2.4 Obsoletes: ansible-fireball < 1.2.4
@ -55,6 +56,7 @@ Obsoletes: %{name}-doc < %{name}-%{release}
%prep %prep
%setup -q %setup -q
%patch0 -p1
%if 0%{?with_python3} %if 0%{?with_python3}
rm -rf %{py3dir} rm -rf %{py3dir}
cp -a . %{py3dir} cp -a . %{py3dir}
@ -114,6 +116,9 @@ cp -pr docs/docsite/rst .
%endif %endif
%changelog %changelog
* Tue Mar 01 2022 wangkai <wangkai385@huawei.com> - 2.9.27-1
- Hostname module support openEuler
* Wed Jan 12 2022 wulei <wulei80@huawei.com> - 2.9.27-0 * Wed Jan 12 2022 wulei <wulei80@huawei.com> - 2.9.27-0
- Package update - Package update

View File

@ -0,0 +1,40 @@
From ae7a72600932ba4a1c1a3c85115f9b609afb7bd5 Mon Sep 17 00:00:00 2001
Date: Mon, 28 Feb 2022 20:02:47 +0800
Subject: [PATCH 1/1] hostname module support openEuler
---
lib/ansible/module_utils/facts/system/distribution.py | 2 +-
lib/ansible/modules/system/hostname.py | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/ansible/module_utils/facts/system/distribution.py b/lib/ansible/module_utils/facts/system/distribution.py
index 09b5a5fd..9046a34a 100644
--- a/lib/ansible/module_utils/facts/system/distribution.py
+++ b/lib/ansible/module_utils/facts/system/distribution.py
@@ -467,7 +467,7 @@ class Distribution(object):
OS_FAMILY_MAP = {'RedHat': ['RedHat', 'Fedora', 'CentOS', 'Scientific', 'SLC',
'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS',
'OEL', 'Amazon', 'Virtuozzo', 'XenServer', 'Alibaba',
- 'AlmaLinux'],
+ 'AlmaLinux', 'openEuler'],
'Debian': ['Debian', 'Ubuntu', 'Raspbian', 'Neon', 'KDE neon',
'Linux Mint', 'SteamOS', 'Devuan', 'Kali', 'Cumulus Linux'],
'Suse': ['SuSE', 'SLES', 'SLED', 'openSUSE', 'openSUSE Tumbleweed',
diff --git a/lib/ansible/modules/system/hostname.py b/lib/ansible/modules/system/hostname.py
index bfc24b35..f10739c5 100644
--- a/lib/ansible/modules/system/hostname.py
+++ b/lib/ansible/modules/system/hostname.py
@@ -782,6 +782,10 @@ class NeonHostname(Hostname):
distribution = 'Neon'
strategy_class = DebianStrategy
+class OpenEulerHostname(Hostname):
+ platform = 'Linux'
+ distribution = 'Openeuler'
+ strategy_class = SystemdStrategy
def main():
module = AnsibleModule(
--
2.27.0