]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Start integrating snippets
authorFrank Brehm <frank@brehm-online.com>
Tue, 28 Jun 2022 13:09:34 +0000 (15:09 +0200)
committerFrank Brehm <frank@brehm-online.com>
Tue, 28 Jun 2022 13:09:34 +0000 (15:09 +0200)
etc/cobbler-distros.yaml.default
lib/cr_vmware_tpl/cobbler.py
templates/el-standard.ks

index 14e0d72d4582125717807e8661123d2daddf66ee..478e8c5d3315c6848526b5ff2217692552c7602f 100644 (file)
@@ -53,6 +53,9 @@ cobbler-distros:
       - 'pixelpark-el8-x86_64'
       - 'monitoring-noarch'
       - 'prometheus-el8-x86_64'
+    snippets:
+      - 'tpl.001.basics.sh'
+      - 'tpl.010.authkeys.sh'
   centos-7:
     distro: 'CentOS-7.9-x86_64'
     description: 'CentOS 7 x86_64'
@@ -101,6 +104,9 @@ cobbler-distros:
       - '-mysql-community*'
       - '-nfs*'
       - '-rpcbind'
+    snippets:
+      - 'tpl.001.basics.sh'
+      - 'tpl.010.authkeys.sh'
   centos-stream-8:
     distro: 'CentOS-Stream-8-x86_64'
     description: 'CentOS Stream 8 x86_64'
@@ -154,6 +160,9 @@ cobbler-distros:
       - '-abrt*'
       - '-nfs*'
       - '-rpcbind'
+    snippets:
+      - 'tpl.001.basics.sh'
+      - 'tpl.010.authkeys.sh'
   oel-7:
     distro: 'Oracle-Linux-7.9-x86_64'
     description: 'Oracle Enterprise Linux 7 x86_64'
@@ -205,6 +214,9 @@ cobbler-distros:
       - '-nfs*'
       - '-rpcbind'
       - '-*uek*'
+    snippets:
+      - 'tpl.001.basics.sh'
+      - 'tpl.010.authkeys.sh'
   rocky-8:
     distro: 'Rocky-8.6-x86_64'
     description: 'Rocky Linux 8 x86_64'
@@ -258,6 +270,9 @@ cobbler-distros:
       - '-abrt*'
       - '-nfs*'
       - '-rpcbind'
+    snippets:
+      - 'tpl.001.basics.sh'
+      - 'tpl.010.authkeys.sh'
 
 cobbler-repos:
   almalinux-8-x86_64-appstream:
index 4cb4c618b7d5151d57feddd1ccb13317d5d403b5..e3cb7b472f5fc926ba8ee1297bd962c7e313aff8 100644 (file)
@@ -46,7 +46,7 @@ from .config import CrTplConfiguration
 
 from .xlate import XLATOR
 
-__version__ = '0.8.4'
+__version__ = '0.8.5'
 
 LOG = logging.getLogger(__name__)
 
@@ -523,12 +523,17 @@ class Cobbler(BaseHandler):
         self.local_ks_file = Path(tmp_ks)
         LOG.debug(_("Using temporary kickstart file {!r}.").format(tmp_ks))
 
+        snippet_lst = []
+        for snippet in sorted(self.cfg.current_distro.snippets.values(), key=str.lower):
+            snippet_lst.append(snippet)
+
         jinja_env = jinja2.Environment(
             loader=jinja2.FileSystemLoader(str(self.base_dir / 'templates')),
             autoescape=jinja2.select_autoescape(),
         )
         ks_template = jinja_env.get_template('el-standard.ks')
-        ks_content = ks_template.render(distro=self.cfg.current_distro) + '\n\n'
+        ks_content = ks_template.render(
+            distro=self.cfg.current_distro, snippets=snippet_lst) + '\n\n'
         if self.verbose > 1:
             LOG.debug(_("Generated kickstart file content:") + '\n' + ks_content)
 
index f3ec695b981e8b19d598705d946ee58de397d801..1b25d01b0cf2c1f03fa164fcd937b6de0d7cd89f 100644 (file)
@@ -146,4 +146,18 @@ echo "ip_address_eth0:      '$ip_address_eth0'"
 echo "mac_address_eth0:     '$mac_address_eth0'"
 echo "System status:        '${system_status}'"
 
+###############################################################################
+# Performing snippets
+
+{%- for snippet in snippets %}
+
+#set $this_snippet= "per_status/" + $SYSTEM_STATUS + "/{{ snippet }}"
+echo
+echo "Using snippet $this_snippet"
+$SNIPPET($this_snippet)
+{%- endfor %}
+
+# ###########################
+# Seems to be finished
+
 %end