fix sosreport exec failed

This commit is contained in:
wangqing 2021-10-12 13:40:05 +08:00
parent 6a71f25738
commit 0905f1a1c6
4 changed files with 54 additions and 48 deletions

View File

@ -0,0 +1,48 @@
From ddede462f885e6a5826cefad49fbb6815436a593 Mon Sep 17 00:00:00 2001
From: panchenbo <panchenbo@uniontech.com>
Date: Tue, 25 May 2021 11:22:56 +0800
Subject: [PATCH] add UnionTech policy
---
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
new file mode 100644
index 0000000..7fbd42c
--- /dev/null
+++ b/sos/policies/UnionTech.py
@@ -0,0 +1,29 @@
+from __future__ import print_function
+
+from sos.plugins import RedHatPlugin
+from sos.policies.redhat import RedHatPolicy, OS_RELEASE
+import os
+
+class UnionTechPolicy(RedHatPolicy):
+
+ distro = "UnionTech"
+ vendor = "the UnionTech Project"
+ vendor_url = "https://www.chinauos.com/"
+
+ def __init__(self, sysroot=None):
+ super(UnionTechPolicy, self).__init__(sysroot=sysroot)
+
+ @classmethod
+ def check(cls):
+ """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
+
+ 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.20.1

View File

@ -1,45 +0,0 @@
From dcb9273e1f5f55fec2957629a5a69ca396f28c51 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Mon, 19 Jul 2021 15:48:03 +0800
Subject: [PATCH] add uniontech os support
---
sos/policies/uniontech.py | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 sos/policies/uniontech.py
diff --git a/sos/policies/uniontech.py b/sos/policies/uniontech.py
new file mode 100644
index 0000000..cd30136
--- /dev/null
+++ b/sos/policies/uniontech.py
@@ -0,0 +1,26 @@
+from __future__ import print_function
+
+from sos.plugins import RedHatPlugin
+from sos.policies.redhat import RedHatPolicy, OS_RELEASE
+import os
+
+class UnionTechPolicy(RedHatPolicy):
+
+ distro = "UnionTech"
+ vendor = "the UnionTech Project"
+ vendor_url = "https://www.chinauos.com/"
+
+ def __init__(self, sysroot=None):
+ super(UnionTechPolicy, self).__init__(sysroot=sysroot)
+
+ @classmethod
+ def check(cls):
+ 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 'UnionTech' in line:
+ return True
+ return False
--
2.23.0

View File

@ -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
+

View File

@ -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 <wangqing@uniontech.com> - 3.8-2
- fix sosreport exec failed
* Tue Sep 14 2021 baizhonggui <baizhonggui@huawei.com> - 3.8-1
- Update to 3.8