[libvirt] [jenkins-ci PATCH v2 4/9] lcitool: include root cause when failing to load facts

Daniel P. Berrangé berrange at redhat.com
Tue Feb 5 17:53:01 UTC 2019


The root cause exception contains the useful information about what
failed during loading.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 guests/lcitool | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/guests/lcitool b/guests/lcitool
index 759eff6..4fb0008 100755
--- a/guests/lcitool
+++ b/guests/lcitool
@@ -202,8 +202,9 @@ class Inventory:
             try:
                 self._facts[host] = self._read_all_facts(host)
                 self._facts[host]["inventory_hostname"] = host
-            except Exception:
-                raise Error("Can't load facts for '{}'".format(host))
+            except Exception as ex:
+                raise Error("Can't load facts for '%(host)s': %(ex)s" %
+                            { "host": host, "ex": ex})
 
     @staticmethod
     def _add_facts_from_file(facts, yaml_path):
-- 
2.20.1




More information about the libvir-list mailing list