]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Defining the final template name.
authorFrank Brehm <frank.brehm@pixelpark.com>
Tue, 9 Jun 2020 08:49:08 +0000 (10:49 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Tue, 9 Jun 2020 08:49:08 +0000 (10:49 +0200)
lib/cr_vmware_tpl/handler.py

index 42bd3d5462f361f6a9e92fdb98e9d063ea178ca2..cffd9c43bc265e87c404154fcefcd492db517013 100644 (file)
@@ -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