From: Frank Brehm Date: Thu, 28 May 2020 14:30:08 +0000 (+0200) Subject: Better error handling X-Git-Tag: 2.1.2^2~9^2~31^2~96 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=13bc4b586da4915642649b2b507c69d96de3e10a;p=pixelpark%2Fcreate-vmware-tpl.git Better error handling --- diff --git a/lib/cr_vmware_tpl/cobbler.py b/lib/cr_vmware_tpl/cobbler.py index d5cab1e..75aa10c 100644 --- a/lib/cr_vmware_tpl/cobbler.py +++ b/lib/cr_vmware_tpl/cobbler.py @@ -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)