From: Frank Brehm Date: Tue, 9 Jun 2020 08:49:08 +0000 (+0200) Subject: Defining the final template name. X-Git-Tag: 2.1.2^2~9^2~31^2~73 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=9d1e1780e6fe4af1895bbab7c8805808de638785;p=pixelpark%2Fcreate-vmware-tpl.git Defining the final template name. --- 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