File koan-improve-virt-install-error-reports.patch of Package cobbler

Index: cobbler-2.6.6/koan/qcreate.py
===================================================================
--- cobbler-2.6.6.orig/koan/qcreate.py
+++ cobbler-2.6.6/koan/qcreate.py
@@ -47,4 +47,7 @@ def start_install(*args, **kwargs):
 
     virtinstall.create_image_file(*args, **kwargs)
     cmd = virtinstall.build_commandline("qemu:///system", *args, **kwargs)
-    utils.subprocess_call(cmd)
+    rc, result, result_stderr = utils.subprocess_get_response(cmd, ignore_rc=True, get_stderr=True)
+    if rc != 0:
+        raise utils.InfoException("command failed (%s): %s %s" % (rc, result, result_stderr))
+
Index: cobbler-2.6.6/koan/xencreate.py
===================================================================
--- cobbler-2.6.6.orig/koan/xencreate.py
+++ cobbler-2.6.6/koan/xencreate.py
@@ -31,4 +31,7 @@ import virtinstall
 
 def start_install(*args, **kwargs):
     cmd = virtinstall.build_commandline("xen:///", *args, **kwargs)
-    utils.subprocess_call(cmd)
+    rc, result, result_stderr = utils.subprocess_get_response(cmd, ignore_rc=True, get_stderr=True)
+    if rc != 0:
+        raise utils.InfoException("command failed (%s): %s %s" % (rc, result, result_stderr))
+
Index: cobbler-2.6.6/koan/imagecreate.py
===================================================================
--- cobbler-2.6.6.orig/koan/imagecreate.py
+++ cobbler-2.6.6/koan/imagecreate.py
@@ -28,4 +28,7 @@ import virtinstall
 
 def start_install(*args, **kwargs):
     cmd = virtinstall.build_commandline("import", *args, **kwargs)
-    utils.subprocess_call(cmd)
+    rc, result, result_stderr = utils.subprocess_get_response(cmd, ignore_rc=True, get_stderr=True)
+    if rc != 0:
+        raise utils.InfoException("command failed (%s): %s %s" % (rc, result, result_stderr))
+
Index: cobbler-2.6.6/koan/utils.py
===================================================================
--- cobbler-2.6.6.orig/koan/utils.py
+++ cobbler-2.6.6/koan/utils.py
@@ -59,7 +59,10 @@ class InfoException(exceptions.Exception
     Custom exception for tracking of fatal errors.
     """
     def __init__(self,value,**args):
-        self.value = value % args
+        if args:
+            self.value = value % args
+        else:
+            self.value = value
         self.from_koan = 1
     def __str__(self):
         return repr(self.value)
openSUSE Build Service is sponsored by