!9 fix unable to read configure file /etc/sos/sos.conf issue and fix dict order py38 incompatibility
From: @tong_1001 Reviewed-by: @overweight Signed-off-by: @overweight
This commit is contained in:
commit
e4bc1709c9
@ -1,55 +0,0 @@
|
|||||||
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
|
|
||||||
|
|
||||||
34
backport-Fix-dict-order-py38-incompatibility.patch
Normal file
34
backport-Fix-dict-order-py38-incompatibility.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From 1d7bab6c7ce3f78758113ca3cdf3e9fa1762df24 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Eric Desrochers <eric.desrochers@canonical.com>
|
||||||
|
Date: Wed, 19 Aug 2020 17:44:07 -0400
|
||||||
|
Subject: [PATCH] [options] Fix dict order py38 incompatibility
|
||||||
|
|
||||||
|
python-3.8 dict changes introduce a traceback during our config file
|
||||||
|
parsing for options with `-` characters in them.
|
||||||
|
|
||||||
|
Fix this by changing an iteration of the dict keys from `dict.keys()`
|
||||||
|
that returns a dict_keys view, to `list(dict)` which returns a list copy
|
||||||
|
of the keys.
|
||||||
|
|
||||||
|
Closes: #2206
|
||||||
|
Resolves: #2207
|
||||||
|
|
||||||
|
Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
|
||||||
|
Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
|
||||||
|
---
|
||||||
|
sos/options.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/sos/options.py b/sos/options.py
|
||||||
|
index 3a2b4292f..ba3db1303 100644
|
||||||
|
--- a/sos/options.py
|
||||||
|
+++ b/sos/options.py
|
||||||
|
@@ -186,7 +186,7 @@ def _update_from_section(section, config):
|
||||||
|
if 'verbose' in odict.keys():
|
||||||
|
odict['verbosity'] = int(odict.pop('verbose'))
|
||||||
|
# convert options names
|
||||||
|
- for key in odict.keys():
|
||||||
|
+ for key in list(odict):
|
||||||
|
if '-' in key:
|
||||||
|
odict[key.replace('-', '_')] = odict.pop(key)
|
||||||
|
# set the values according to the config file
|
||||||
28
sos.spec
28
sos.spec
@ -2,15 +2,16 @@
|
|||||||
|
|
||||||
Name: sos
|
Name: sos
|
||||||
Version: 4.0
|
Version: 4.0
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: A set of tools to gather troubleshooting information from a system
|
Summary: A set of tools to gather troubleshooting information from a system
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: https://github.com/sosreport/sos
|
URL: https://github.com/sosreport/sos
|
||||||
Source0: https://github.com/sosreport/sos/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
Source0: https://github.com/sosreport/sos/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||||
Patch0000: 0001-hoperun-openeuler-sos-policy.patch
|
|
||||||
BuildRequires: python3-devel gettext python3-six
|
Patch6000: backport-Fix-dict-order-py38-incompatibility.patch
|
||||||
Requires: libxml2-python3 bzip2 xz python3-six
|
|
||||||
Conflicts: vdsm <= 4.30.17
|
BuildRequires: python3-devel gettext
|
||||||
|
Requires: libxml2-python3 bzip2 xz python3-rpm tar python3-pexpect
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -27,15 +28,25 @@ aimed at Linux distributions and other UNIX-like operating systems.
|
|||||||
|
|
||||||
%install
|
%install
|
||||||
%py3_install '--install-scripts=%{_sbindir}'
|
%py3_install '--install-scripts=%{_sbindir}'
|
||||||
install -Dm644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf
|
|
||||||
|
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}
|
||||||
|
install -d -m 700 %{buildroot}%{_sysconfdir}/%{name}/cleaner
|
||||||
|
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}/presets.d
|
||||||
|
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}/groups.d
|
||||||
|
install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}/extras.d
|
||||||
|
install -m 644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
|
||||||
|
|
||||||
%find_lang %{name} || echo 0
|
%find_lang %{name} || echo 0
|
||||||
|
|
||||||
%files -f %{name}.lang
|
%files -f %{name}.lang
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
%config(noreplace) %{_sysconfdir}/sos.conf
|
%config(noreplace) %{_sysconfdir}/sos/sos.conf
|
||||||
%{_sbindir}/sos*
|
%{_sbindir}/sos*
|
||||||
|
%dir /etc/sos/cleaner
|
||||||
|
%dir /etc/sos/presets.d
|
||||||
|
%dir /etc/sos/extras.d
|
||||||
|
%dir /etc/sos/groups.d
|
||||||
%{python3_sitelib}/*
|
%{python3_sitelib}/*
|
||||||
%exclude %{_datadir}/doc/sos/{AUTHORS,README.md}
|
%exclude %{_datadir}/doc/sos/{AUTHORS,README.md}
|
||||||
|
|
||||||
@ -46,6 +57,9 @@ install -Dm644 %{name}.conf %{buildroot}%{_sysconfdir}/%{name}.conf
|
|||||||
%{_mandir}/man5/*
|
%{_mandir}/man5/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Mar 03 2021 shixuantong <shixuantong@huawei.com> - 4.0-2
|
||||||
|
- fix unable to read configure file /etc/sos/sos.conf issue
|
||||||
|
|
||||||
* Tue Feb 02 2021 shixuantong <shixuantong@huawei.com> - 4.0-1
|
* Tue Feb 02 2021 shixuantong <shixuantong@huawei.com> - 4.0-1
|
||||||
- Upgrade to version 4.0
|
- Upgrade to version 4.0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user