From 32458fab9137c30426358ed2f61f45308cb22ba1 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 11 Jun 2020 13:53:32 +0200 Subject: [PATCH] Completing creating a cobbler system --- lib/cr_vmware_tpl/cobbler.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lib/cr_vmware_tpl/cobbler.py b/lib/cr_vmware_tpl/cobbler.py index cd53411..3e749b5 100644 --- a/lib/cr_vmware_tpl/cobbler.py +++ b/lib/cr_vmware_tpl/cobbler.py @@ -37,7 +37,7 @@ from .config import CrTplConfiguration from .xlate import XLATOR -__version__ = '0.4.7' +__version__ = '0.4.8' LOG = logging.getLogger(__name__) @@ -664,12 +664,36 @@ class Cobbler(BaseHandler): if ks_meta: args.append('--ksmeta') args.append(ks_meta) + args.append('--kickstart') + args.append(str(self.config.system_ks)) + args.append('--power-type') + args.append('apc') + args.append('--hostname') + args.append(fqdn) + args.append('--mac-address') + args.append(mac_address) + args.append('--interface') + args.append('eth0') + args.append('--management') + args.append('true') cmd_str = 'cobbler ' + ' '.join(map(lambda x: pipes.quote(x), args)) LOG.debug("Should execute: {}".format(cmd_str)) if self.verbose > 1: LOG.debug(_("Cobbler arguments for creating a new system:") + "\n" + pp(args)) + 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 system - returncode was {rc}: {err}").format( + rc=proc.returncode, err=err) + raise ExpectedCobblerError(msg) + # ============================================================================= if __name__ == "__main__": -- 2.39.5