add KylinSec OS support

This commit is contained in:
liuxingxiang 2022-04-14 11:48:58 +08:00
parent 1b025d40a0
commit b6c31e1b27
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From bf2a712488b3c980342293439400f5c4f476fa6c Mon Sep 17 00:00:00 2001
From: liuxingxiang <liuxingxiang@kylinsec.com.cn>
Date: Wed, 23 Feb 2022 09:39:22 +0800
Subject: [PATCH 1/1] add KylinSec OS support
---
sos/policies/KylinSec.py | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
create mode 100644 sos/policies/KylinSec.py
diff --git a/sos/policies/KylinSec.py b/sos/policies/KylinSec.py
new file mode 100644
index 0000000..bf0b6f3
--- /dev/null
+++ b/sos/policies/KylinSec.py
@@ -0,0 +1,30 @@
+from sos.policies.redhat import RedHatPolicy, OS_RELEASE
+import os
+
+class KylinSecPolicy(RedHatPolicy):
+
+ distro = "KylinSec"
+ vendor = "KylinSec"
+ vendor_url = "http://www.kylinsec.com.cn/"
+
+ def __init__(self, sysroot=None, init=None, probe_runtime=True,
+ remote_exec=None):
+ super(KylinSecPolicy, 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 'KylinSec OS' in line:
+ return True
+ return False
--
2.27.0

View File

@ -2,7 +2,7 @@
Name: sos
Version: 4.0
Release: 5
Release: 6
Summary: A set of tools to gather troubleshooting information from a system
License: GPLv2+
URL: https://github.com/sosreport/sos
@ -12,6 +12,7 @@ Patch6000: backport-Fix-dict-order-py38-incompatibility.patch
Patch9000: openEuler-add-openEuler-policy.patch
Patch9001: add-uniontech-os-support.patch
Patch9002: Fix-sos-command-failed-in-sos-4.0.patch
Patch9003: add-KylinSec-OS-support.patch
BuildRequires: python3-devel gettext
Requires: libxml2-python3 bzip2 xz python3-rpm tar python3-pexpect
@ -60,6 +61,9 @@ install -m 644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
%{_mandir}/man5/*
%changelog
* Wed Feb 23 2022 liuxingxiang <liuxingxiang@kylinsec.com.cn> - 4.0-6
- add KylinSec policy
* Tue Feb 22 2022 weidong <weidong@uniontech.com> - 4.0-5
- Fix sos command failed in sos 4.0