From 70c3c2fe1921dc3c2350240cee6d1f71d748baaa Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 10 Jun 2020 18:27:10 +0200 Subject: [PATCH] Starting with kssnippets --- lib/cr_vmware_tpl/cobbler.py | 10 ++++++++-- snippets/tpl.001.basics.sh | 21 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 snippets/tpl.001.basics.sh diff --git a/lib/cr_vmware_tpl/cobbler.py b/lib/cr_vmware_tpl/cobbler.py index 810c3ff..34d077f 100644 --- a/lib/cr_vmware_tpl/cobbler.py +++ b/lib/cr_vmware_tpl/cobbler.py @@ -345,9 +345,10 @@ class Cobbler(BaseHandler): return profile_list # ------------------------------------------------------------------------- - def ensure_remote_file(self, local_file, remote_file): + def ensure_remote_file(self, local_file, remote_file, check_parent=True): - self.check_remote_directory(remote_file.parent) + if check_parent: + self.check_remote_directory(remote_file.parent) if self.verbose > 1: msg = _("Checking remote file {rfile!r} based on local {lfile!r} ...").format( @@ -607,6 +608,11 @@ class Cobbler(BaseHandler): self.ensure_remote_file(local_ks, remote_ks) + # ------------------------------------------------------------------------- + def ensure_snippets(self): + + local_snippets_dir = self.base_dir / 'snippets' + # ------------------------------------------------------------------------- def add_system(self, name, fqdn, mac_address, comment=None): """Creating a new system.""" diff --git a/snippets/tpl.001.basics.sh b/snippets/tpl.001.basics.sh new file mode 100644 index 0000000..15e9720 --- /dev/null +++ b/snippets/tpl.001.basics.sh @@ -0,0 +1,21 @@ +## !/bin/bash +#raw + +HASH_LINE="#######################################################################################" + +echo "$(date --rfc-3339=seconds): Das ist das Post-Install-Script '$0'." +echo + +if [[ -z "${hostname}" ]] ; then + hostname="template.pixelpark.com" +fi +IP_ADDRESS_ETH0=$( host "${hostname}" | sed -e 's/.*has address[ ][ ]*//' ) +DOMAIN=$( echo "${hostname}" | cut -d. -f2,3 ) +SIMPLE_HOSTNAME=$( echo "${hostname}" | cut -d. -f1 ) + +if [[ -z "${ip_address_eth0}" ]] ; then + ip_address_eth0="${IP_ADDRESS_ETH0}" +fi + +#end raw +## vim: ts=4 et list -- 2.39.5