From 9d1e1780e6fe4af1895bbab7c8805808de638785 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 9 Jun 2020 10:49:08 +0200 Subject: [PATCH] Defining the final template name. --- lib/cr_vmware_tpl/handler.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index 42bd3d5..cffd9c4 100644 --- a/lib/cr_vmware_tpl/handler.py +++ b/lib/cr_vmware_tpl/handler.py @@ -40,7 +40,7 @@ from .cobbler import CobblerError, Cobbler from .xlate import XLATOR -__version__ = '1.5.1' +__version__ = '1.5.2' LOG = logging.getLogger(__name__) TZ = pytz.timezone('Europe/Berlin') @@ -150,6 +150,16 @@ class CrTplHandler(BaseHandler): return self.tpl_vm_hostname return self.tpl_vm_hostname + '.' + self.config.tpl_vm_domain + # ------------------------------------------------------------------------- + @property + def tpl_name(self): + """The final name of the VSphere template.""" + if not self.config: + return None + if not self.config.os_id: + return None + return 'template-' + self.config.os_id + # ------------------------------------------------------------------------- def as_dict(self, short=True): """ @@ -163,6 +173,7 @@ class CrTplHandler(BaseHandler): """ res = super(CrTplHandler, self).as_dict(short=short) + res['tpl_name'] = self.tpl_name res['tpl_vm_fqdn'] = self.tpl_vm_fqdn return res -- 2.39.5