]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Completing creating a cobbler system
authorFrank Brehm <frank.brehm@pixelpark.com>
Thu, 11 Jun 2020 11:53:32 +0000 (13:53 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Thu, 11 Jun 2020 11:53:32 +0000 (13:53 +0200)
lib/cr_vmware_tpl/cobbler.py

index cd534111d4f5b7e998a3b1853d236120d6528cbf..3e749b513e81da107fc5017b57f65700403db295 100644 (file)
@@ -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__":