aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Hunsaker <jhunsake@redhat.com>2020-12-17 17:39:46 -0500
committerJake Hunsaker <jhunsake@redhat.com>2021-01-04 11:55:11 -0500
commit3ad800fd5bfb6dc90aa55361cbad1f9e962f423c (patch)
treeeb08a5e43d0c0fde30b2d78b1078f6506936bb79
parent6698a77161ff1d8c676086b9110fdc53c456e480 (diff)
downloadsos-3ad800fd5bfb6dc90aa55361cbad1f9e962f423c.tar.gz
[DpkgPackageManager] Add subclass for dpkg
Adds a new `DpkgPackageManager` subclass for use with dpkg-based distributions. Closes: #2349 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--sos/policies/distros/debian.py12
-rw-r--r--sos/policies/package_managers/dpkg.py23
2 files changed, 26 insertions, 9 deletions
diff --git a/sos/policies/distros/debian.py b/sos/policies/distros/debian.py
index 29c74dc9..69a92192 100644
--- a/sos/policies/distros/debian.py
+++ b/sos/policies/distros/debian.py
@@ -8,7 +8,7 @@
from sos.report.plugins import DebianPlugin
from sos.policies.distros import LinuxPolicy
-from sos.policies.package_managers import PackageManager
+from sos.policies.package_managers.dpkg import DpkgPackageManager
import os
@@ -18,9 +18,6 @@ class DebianPolicy(LinuxPolicy):
vendor = "the Debian project"
vendor_urls = [('Community Website', 'https://www.debian.org/')]
ticket_number = ""
- _debq_cmd = "dpkg-query -W -f='${Package}|${Version}\\n'"
- _debv_cmd = "dpkg --verify"
- _debv_filter = ""
name_pattern = 'friendly'
valid_subclasses = [DebianPlugin]
PATH = "/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" \
@@ -32,11 +29,8 @@ class DebianPolicy(LinuxPolicy):
super(DebianPolicy, self).__init__(sysroot=sysroot, init=init,
probe_runtime=probe_runtime)
self.ticket_number = ""
- self.package_manager = PackageManager(query_command=self._debq_cmd,
- verify_command=self._debv_cmd,
- verify_filter=self._debv_filter,
- chroot=sysroot,
- remote_exec=remote_exec)
+ self.package_manager = DpkgPackageManager(chroot=sysroot,
+ remote_exec=remote_exec)
self.valid_subclasses += [DebianPlugin]
def _get_pkg_name_for_binary(self, binary):
diff --git a/sos/policies/package_managers/dpkg.py b/sos/policies/package_managers/dpkg.py
new file mode 100644
index 00000000..7619e929
--- /dev/null
+++ b/sos/policies/package_managers/dpkg.py
@@ -0,0 +1,23 @@
+# Copyright 2020 Red Hat, Inc. Jake Hunsaker <jhunsake@redhat.com>
+
+# 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.
+
+from sos.policies.package_managers import PackageManager
+
+
+class DpkgPackageManager(PackageManager):
+ """Subclass for dpkg-based distrubitons
+ """
+
+ query_command = "dpkg-query -W -f='${Package}|${Version}\\n'"
+ verify_command = "dpkg --verify"
+ verify_filter = ""
+
+
+# vim: set et ts=4 sw=4 :