Fix the sosreport error

This commit is contained in:
yaokai13 2020-07-13 18:44:06 +08:00
parent ac4c611ca2
commit d4d2c7a2f6
2 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,55 @@
From 96ac9e7f7c2502f64f7ebae77fbca18ce2b6fdb9 Mon Sep 17 00:00:00 2001
From: jeff200902 <jeff200902@163.com>
Date: Mon, 13 Jul 2020 09:52:11 +0000
Subject: [PATCH] hoperun-openeuler-sos-policy
---
sos/policies/openEuler.py | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 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..de58f92
--- /dev/null
+++ b/sos/policies/openEuler.py
@@ -0,0 +1,36 @@
+# Copyright (C) Huawei, Inc. 2020
+
+# This file is part of the sos project: https://github.com/sosreport/sos
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# version 2 of the GNU General Public License.
+#
+# See the LICENSE file in the source distribution for further information.
+
+# This enables the use of with syntax in python 2.5 (e.g. jython)
+from __future__ import print_function
+
+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):
+ super(OpenEulerPolicy, self).__init__(sysroot=sysroot)
+
+ @classmethod
+ def check(cls):
+ """This method checks to see if we are running on OpenEuler. It returns
+ True or False."""
+ 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"])
--
2.23.0

View File

@ -2,11 +2,12 @@
Name: sos
Version: 3.9.1
Release: 2
Release: 3
Summary: A set of tools to gather troubleshooting information from a system
License: GPLv2+
URL: https://github.com/sosreport/sos
Source0: https://github.com/sosreport/sos/archive/%{version}.tar.gz
Patch0000: 0001-hoperun-openeuler-sos-policy.patch
BuildRequires: python3-devel gettext python3-six
Requires: libxml2-python3 bzip2 xz python3-six
Conflicts: vdsm <= 4.30.17
@ -44,6 +45,9 @@ install -Dm644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf
%{_mandir}/man5/sos.conf.5.gz
%changelog
* Mon Jul 13 2020 Jeffery.Gao <gaojianxing@huawei.com> - 3.9.1-3
- Append openEuler policy
* Mon Jun 1 2020 chengzihan <chengzihan2@huawei.com> - 3.9.1-2
- Package update