aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Moravec <pmoravec@redhat.com>2018-06-18 11:40:57 +0200
committerBryn M. Reeves <bmr@redhat.com>2018-06-18 15:50:24 +0100
commit6a9ffd67fe2f69f473226f746bfb154803d863a1 (patch)
tree21d3261821a0aa6a9f385f614380c337a9635962
parenta065c50b5cfb8827063c2dcb9357a7e8de6b8035 (diff)
downloadsos-6a9ffd67fe2f69f473226f746bfb154803d863a1.tar.gz
[policies] add auxiliary function _get_pkg_name_for_binary
In some cases, we need to determine what package provides given binary. This auxiliary function implements it - so far it works for and will be used by archive methods. Related to: #1196 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
-rw-r--r--sos/policies/__init__.py6
-rw-r--r--sos/policies/debian.py6
2 files changed, 12 insertions, 0 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index b5cfc819..047b646f 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -321,6 +321,12 @@ No changes will be made to system configuration.
)
return time.strftime(nstr)
+ # for some specific binaries like "xz", we need to determine package
+ # providing it; that is policy specific. By default return the binary
+ # name itself until particular policy overwrites it
+ def _get_pkg_name_for_binary(self, binary):
+ return binary
+
def get_tmp_dir(self, opt_tmp_dir):
if not opt_tmp_dir:
return tempfile.gettempdir()
diff --git a/sos/policies/debian.py b/sos/policies/debian.py
index 15648d5d..358e831b 100644
--- a/sos/policies/debian.py
+++ b/sos/policies/debian.py
@@ -26,6 +26,12 @@ class DebianPolicy(LinuxPolicy):
self.valid_subclasses = [DebianPlugin]
+ def _get_pkg_name_for_binary(self, binary):
+ # for binary not specified inside {..}, return binary itself
+ return {
+ "xz": "xz-utils"
+ }.get(binary, binary)
+
@classmethod
def check(cls):
"""This method checks to see if we are running on Debian.