From 13bc4b586da4915642649b2b507c69d96de3e10a Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 28 May 2020 16:30:08 +0200 Subject: [PATCH] Better error handling --- lib/cr_vmware_tpl/cobbler.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) -- 2.39.5