From 1ec3b014d5dbe60e27a5294d8ec1099e6f85a4e3 Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Mon, 3 Dec 2018 19:13:41 +0100
Subject: [PATCH] Improve error reporting when rpm transactions are not
 installed

---
 src/mio.py           | 11 ++++++++---
 src/mio/installer.py |  5 +++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/mio.py b/src/mio.py
index 84a2b42..b60802f 100755
--- a/src/mio.py
+++ b/src/mio.py
@@ -332,9 +332,14 @@ if __name__ == '__main__':
 
         if not options.noyum:
             log(NORMAL, "Installing rpms")
-            (rpm_result, failed) = installer.install_rpms(options.path,
-                                                          options.exclude_rpm)
-
+            try:
+                (rpm_result, failed) = installer.install_rpms(
+                    options.path, options.exclude_rpm)
+                pass
+            except Exception, e:
+                log(MUTE, "Failed to install rpm's, rerun with '--noyum'")
+                exit(1)
+                pass
         log(NORMAL, "Installing files")
         installer.install_groups(options.prefix,
                                  (options.backup, options.backup_suffix))
diff --git a/src/mio/installer.py b/src/mio/installer.py
index 750f8ac..cea28c4 100755
--- a/src/mio/installer.py
+++ b/src/mio/installer.py
@@ -1,8 +1,9 @@
 import fnmatch
+import sys
 try:
     import mio.rpmDB
-except:
-    # Hopefully not needing rpm's
+except ImportError, e:
+    print>>sys.stdout, 'No rpm support [neither python-dnf or yum installed]'
     pass
 import mio.util
 import mio.yum
-- 
GitLab