50 lines
1.4 KiB
Diff
50 lines
1.4 KiB
Diff
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
|
|
|