[PATCH] Fix a possible "yum history stats" tb. BZ 1059184

Zdenek Pavlas zpavlas at redhat.com
Thu Jan 30 10:50:16 UTC 2014


---
 yumcommands.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/yumcommands.py b/yumcommands.py
index 8bba0c5..4214383 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -2976,6 +2976,9 @@ class HistoryCommand(YumCommand):
             print _("Transactions:"), 0
             return
         counts = base.history._pkg_stats()
+        if not counts:
+            msg = _("could not open history file: %s") % base.history._db_file
+            raise yum.Errors.MiscError, msg
         trans_1 = base.history.old("1")[0]
         print _("Transactions:"), trans_N.tid
         print _("Begin time  :"), time.ctime(trans_1.beg_timestamp)
-- 
1.7.11.7



More information about the Yum-devel mailing list