diff options
author | Yedidyah Bar David <didi@redhat.com> | 2016-07-24 17:38:51 +0300 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-01-17 12:39:58 +0000 |
commit | 7c428d118c13704753136869ed862bfac09175a2 (patch) | |
tree | 195ad26c0ff333d05bfa2ed9e9136b9d8ae817c6 | |
parent | 4d75385ad15d15e5cdb3b4c9cc7b9c0cf38057d4 (diff) | |
download | sos-7c428d118c13704753136869ed862bfac09175a2.tar.gz |
[yum] [dnf] add output of history info
Add a list of installed/erased/updated packages per yum/dnf transaction.
Signed-off-by: Yedidyah Bar David <didi@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Closes: #857.
-rw-r--r-- | sos/plugins/dnf.py | 16 | ||||
-rw-r--r-- | sos/plugins/yum.py | 17 |
2 files changed, 31 insertions, 2 deletions
diff --git a/sos/plugins/dnf.py b/sos/plugins/dnf.py index c371d67b..c2198ae9 100644 --- a/sos/plugins/dnf.py +++ b/sos/plugins/dnf.py @@ -26,7 +26,8 @@ class DNFPlugin(Plugin, RedHatPlugin): packages = ('dnf',) option_list = [ - ("history", "captures transaction history", "fast", False) + ("history", "captures transaction history", "fast", False), + ("history-info", "detailed transaction history", "slow", False), ] def setup(self): @@ -60,4 +61,17 @@ class DNFPlugin(Plugin, RedHatPlugin): if self.get_option("history"): self.add_cmd_output("dnf history") + if self.get_option("history-info"): + history = self.call_ext_prog("dnf history") + transactions = None + if history['output']: + for line in history['output'].splitlines(): + try: + transactions = int(line.split('|')[0].strip()) + break + except ValueError: + pass + for tr_id in range(1, transactions+1): + self.add_cmd_output("dnf history info %d" % tr_id) + # vim: set et ts=4 sw=4 : diff --git a/sos/plugins/yum.py b/sos/plugins/yum.py index 555a3508..92626a33 100644 --- a/sos/plugins/yum.py +++ b/sos/plugins/yum.py @@ -27,7 +27,8 @@ class Yum(Plugin, RedHatPlugin): option_list = [ ("yumlist", "list repositories and packages", "slow", False), - ("yumdebug", "gather yum debugging data", "slow", False) + ("yumdebug", "gather yum debugging data", "slow", False), + ("yum-history-info", "gather yum history info", "slow", False), ] def setup(self): @@ -52,6 +53,20 @@ class Yum(Plugin, RedHatPlugin): ]) self.add_cmd_output("yum history") + # packages installed/erased/updated per transaction + if self.get_option("yum-history-info"): + history = self.call_ext_prog("yum history") + transactions = None + if history['output']: + for line in history['output'].splitlines(): + try: + transactions = int(line.split('|')[0].strip()) + break + except ValueError: + pass + for tr_id in range(1, transactions+1): + self.add_cmd_output("yum history info %d" % tr_id) + if self.get_option("yumlist"): # List various information about available packages self.add_cmd_output("yum list") |