51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
From 3b76979a51f8b8e65991c00cd4ebab2f23a467a6 Mon Sep 17 00:00:00 2001
|
|
From: shixuantong <shixuantong@huawei.com>
|
|
Date: Mon, 8 Mar 2021 20:56:05 +0800
|
|
Subject: [PATCH] add openEuler policy
|
|
|
|
this patch is based on sos-4.0, not applicable to the lower version.
|
|
---
|
|
sos/policies/openEuler.py | 30 ++++++++++++++++++++++++++++++
|
|
1 file changed, 30 insertions(+)
|
|
create mode 100644 sos/policies/openEuler.py
|
|
|
|
diff --git a/sos/policies/openEuler.py b/sos/policies/openEuler.py
|
|
new file mode 100644
|
|
index 0000000..ea65ba2
|
|
--- /dev/null
|
|
+++ b/sos/policies/openEuler.py
|
|
@@ -0,0 +1,30 @@
|
|
+from __future__ import print_function
|
|
+
|
|
+from sos.report.plugins import RedHatPlugin
|
|
+from sos.policies.redhat import RedHatPolicy, OS_RELEASE
|
|
+import os
|
|
+
|
|
+class OpenEulerPolicy(RedHatPolicy):
|
|
+
|
|
+ distro = "OpenEuler"
|
|
+ vendor = "the openEuler Project"
|
|
+ vendor_url = "https://openeuler.org/"
|
|
+
|
|
+ def __init__(self, sysroot=None, init=None, probe_runtime=True,
|
|
+ remote_exec=None):
|
|
+ super(OpenEulerPolicy, self).__init__(sysroot=sysroot, init=init,
|
|
+ probe_runtime=probe_runtime,
|
|
+ remote_exec=remote_exec)
|
|
+
|
|
+ @classmethod
|
|
+ def check(cls, remote=''):
|
|
+ """This method checks to see if we are running on OpenEuler. It returns
|
|
+ True or False."""
|
|
+ if remote:
|
|
+ return cls.distro in remote
|
|
+ return os.path.isfile('/etc/openEuler-release')
|
|
+
|
|
+ def openEuler_version(self):
|
|
+ pkg = self.pkg_by_name("openEuler-release") or \
|
|
+ self.all_pkgs_by_name_regex("openEuler-release-.*")[-1]
|
|
+ return int(pkg["version"])
|
|
--
|
|
1.8.3.1
|
|
|