From 0905f1a1c6bc5373e2fedc8e31d9fe4722ef7212 Mon Sep 17 00:00:00 2001 From: wangqing Date: Tue, 12 Oct 2021 13:40:05 +0800 Subject: [PATCH] fix sosreport exec failed --- ...ch => UnionTech-add-UnionTech-policy.patch | 43 ++++++++++--------- openEuler-add-openEuler-policy.patch | 2 +- sos.spec | 7 ++- 3 files changed, 29 insertions(+), 23 deletions(-) rename add-uniontech-os-support.patch => UnionTech-add-UnionTech-policy.patch (36%) diff --git a/add-uniontech-os-support.patch b/UnionTech-add-UnionTech-policy.patch similarity index 36% rename from add-uniontech-os-support.patch rename to UnionTech-add-UnionTech-policy.patch index c865c31..e9c7852 100644 --- a/add-uniontech-os-support.patch +++ b/UnionTech-add-UnionTech-policy.patch @@ -1,19 +1,19 @@ -From dcb9273e1f5f55fec2957629a5a69ca396f28c51 Mon Sep 17 00:00:00 2001 -From: root -Date: Mon, 19 Jul 2021 15:48:03 +0800 -Subject: [PATCH] add uniontech os support +From ddede462f885e6a5826cefad49fbb6815436a593 Mon Sep 17 00:00:00 2001 +From: panchenbo +Date: Tue, 25 May 2021 11:22:56 +0800 +Subject: [PATCH] add UnionTech policy --- - sos/policies/uniontech.py | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - create mode 100644 sos/policies/uniontech.py + sos/policies/UnionTech.py | 29 +++++++++++++++++++++++++++++ + 1 file changed, 29 insertions(+) + create mode 100644 sos/policies/UnionTech.py -diff --git a/sos/policies/uniontech.py b/sos/policies/uniontech.py +diff --git a/sos/policies/UnionTech.py b/sos/policies/UnionTech.py new file mode 100644 -index 0000000..cd30136 +index 0000000..7fbd42c --- /dev/null -+++ b/sos/policies/uniontech.py -@@ -0,0 +1,26 @@ ++++ b/sos/policies/UnionTech.py +@@ -0,0 +1,29 @@ +from __future__ import print_function + +from sos.plugins import RedHatPlugin @@ -31,15 +31,18 @@ index 0000000..cd30136 + + @classmethod + def check(cls): -+ if not os.path.exists(OS_RELEASE): ++ """This method checks to see if we are running on UnionTechOS. It returns ++ True or False.""" ++ try: ++ with open("/etc/UnionTech-release", "r") as f: ++ return "uos" in f.read() ++ except IOError: + return False -+ -+ with open(OS_RELEASE, 'r') as f: -+ for line in f: -+ if line.startswith('NAME'): -+ if 'UnionTech' in line: -+ return True -+ return False ++ ++ def UnionTech_version(self): ++ pkg = self.pkg_by_name("UnionTech-release") or \ ++ self.all_pkgs_by_name_regex("UnionTech-release-.*")[-1] ++ return int(pkg["version"]) -- -2.23.0 +2.20.1 diff --git a/openEuler-add-openEuler-policy.patch b/openEuler-add-openEuler-policy.patch index a102f64..bb22f7e 100644 --- a/openEuler-add-openEuler-policy.patch +++ b/openEuler-add-openEuler-policy.patch @@ -17,7 +17,7 @@ index 0000000..ea65ba2 @@ -0,0 +1,30 @@ +from __future__ import print_function + -+from sos.report.plugins import RedHatPlugin ++from sos.plugins import RedHatPlugin +from sos.policies.redhat import RedHatPolicy, OS_RELEASE +import os + diff --git a/sos.spec b/sos.spec index b7ebdc7..ad2f972 100644 --- a/sos.spec +++ b/sos.spec @@ -2,14 +2,14 @@ Name: sos Version: 3.8 -Release: 1 +Release: 2 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}/%{name}-%{version}.tar.gz Patch9000: openEuler-add-openEuler-policy.patch -Patch9001: add-uniontech-os-support.patch +Patch9001: UnionTech-add-UnionTech-policy.patch BuildRequires: python3-devel gettext python3-six Requires: libxml2-python3 xz python3-rpm tar bzip2 python3-six @@ -47,6 +47,9 @@ install -Dm644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf %{_mandir}/man5/* %changelog +* Tue Oct 12 2021 wangqing - 3.8-2 +- fix sosreport exec failed + * Tue Sep 14 2021 baizhonggui - 3.8-1 - Update to 3.8 -- Gitee