!40 Add Kylin policy

From: @jxy_git 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
This commit is contained in:
openeuler-ci-bot 2023-11-06 09:49:58 +00:00 committed by Gitee
commit b541ec0eab
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 58 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From 143db4a9516bd0e1c4c4b1e8a7aa91c04ee1699e Mon Sep 17 00:00:00 2001
From: jxy_git <jiangxinyu@kylinos.cn>
Date: Mon, 6 Nov 2023 17:31:38 +0800
Subject: [PATCH] add Kylin OS support
---
sos/policies/Kylin.py | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 sos/policies/Kylin.py
diff --git a/sos/policies/Kylin.py b/sos/policies/Kylin.py
new file mode 100644
index 0000000..dbbb229
--- /dev/null
+++ b/sos/policies/Kylin.py
@@ -0,0 +1,34 @@
+from sos.policies.redhat import RedHatPolicy, OS_RELEASE
+import os
+
+class KylinPolicy(RedHatPolicy):
+
+ distro = "Kylin Linux Advanced Server"
+ vendor = "Kylin"
+ vendor_urls = [
+ ('Distribution Website', 'https://www.kylinos.cn/'),
+ ('Vendor Website', 'https://www.kylinos.cn/')
+ ]
+
+ def __init__(self, sysroot=None, init=None, probe_runtime=True,
+ remote_exec=None):
+ super(KylinPolicy, self).__init__(sysroot=sysroot, init=init,
+ probe_runtime=probe_runtime,
+ remote_exec=remote_exec)
+
+ @classmethod
+ def check(cls, remote=''):
+
+ if remote:
+ return cls.distro in remote
+
+ if not os.path.exists(OS_RELEASE):
+ return False
+
+ with open(OS_RELEASE, 'r') as f:
+ for line in f:
+ if line.startswith('NAME'):
+ if 'Kylin Linux' in line:
+ return True
+ return False
+
--
2.33.0

View File

@ -2,7 +2,7 @@
Name: sos Name: sos
Version: 4.5.6 Version: 4.5.6
Release: 1 Release: 2
Summary: A set of tools to gather troubleshooting information from a system Summary: A set of tools to gather troubleshooting information from a system
License: GPLv2+ License: GPLv2+
URL: https://github.com/sosreport/sos URL: https://github.com/sosreport/sos
@ -12,6 +12,7 @@ Patch9000: openEuler-add-openEuler-policy.patch
Patch9001: add-uniontech-os-support.patch Patch9001: add-uniontech-os-support.patch
Patch9002: Fix-sos-command-failed-in-sos-4.0.patch Patch9002: Fix-sos-command-failed-in-sos-4.0.patch
Patch9003: add-KylinSec-OS-support.patch Patch9003: add-KylinSec-OS-support.patch
Patch9004: add-Kylin-OS-support.patch
BuildRequires: python3-devel gettext BuildRequires: python3-devel gettext
Requires: bzip2 xz python3-rpm tar python3-pexpect Requires: bzip2 xz python3-rpm tar python3-pexpect
@ -66,6 +67,9 @@ rm -rf ${RPM_BUILD_ROOT}/usr/config/
%{_mandir}/man5/* %{_mandir}/man5/*
%changelog %changelog
* Mon Nov 06 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 4.5.6-2
- add Kylin policy
* Thu Jul 27 2023 dillon chen < dillon.chen@gmail.com> - 4.5.6-1 * Thu Jul 27 2023 dillon chen < dillon.chen@gmail.com> - 4.5.6-1
- update to 4.5.6 - update to 4.5.6