]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Better error handling
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 28 May 2020 14:30:08 +0000 (16:30 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 28 May 2020 14:30:08 +0000 (16:30 +0200)
lib/cr_vmware_tpl/cobbler.py

index d5cab1e917d2fa5b43a28890a2003c524a4bae02..75aa10cc7d817e595dc85a1dc2856837295eaa98 100644 (file)
@@ -285,8 +285,13 @@ class Cobbler(BaseHandler):
         proc = self.exec_cobbler(args)
 
         if proc.returncode:
+            err = _('No error message')
+            if proc.stderr:
+                err = proc.stderr
+            elif proc.stdout:
+                err = proc.stdout
             msg = _("Error creating a cobbler profile - returncode was {rc}: {err}").format(
-                rc=proc.returncode, err=proc.stderr)
+                rc=proc.returncode, err=err)
             raise ExpectedCobblerError(msg)