From: Frank Brehm Date: Tue, 9 Jun 2020 08:58:06 +0000 (+0200) Subject: Preparations in VSPhere X-Git-Tag: 2.1.2^2~9^2~31^2~72 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=ed0f199b46265c16f43fb101248eccc6f5e932fb;p=pixelpark%2Fcreate-vmware-tpl.git Preparations in VSPhere --- diff --git a/lib/cr_vmware_tpl/handler.py b/lib/cr_vmware_tpl/handler.py index cffd9c4..074d3ee 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.2' +__version__ = '1.5.3' LOG = logging.getLogger(__name__) TZ = pytz.timezone('Europe/Berlin') @@ -225,8 +225,6 @@ class CrTplHandler(BaseHandler): self.cobbler.ensure_profile() self.cobbler.ensure_root_authkeys() - return 0 - self.vsphere.get_about() self.vsphere.get_clusters() self.cluster = self.vsphere.get_cluster_by_name(self.config.vsphere_cluster) @@ -243,11 +241,12 @@ class CrTplHandler(BaseHandler): return 6 self.vsphere.get_networks() - self.vsphere.ensure_vm_folder(self.config.folder) self.check_for_temp_tpl_vm(no_error=True) self.select_data_store() + return 0 + if self.rotate_only: LOG.warn(_("Only executing of template rotating.")) else: @@ -302,21 +301,21 @@ class CrTplHandler(BaseHandler): # ------------------------------------------------------------------------- def check_for_temp_tpl_vm(self, no_error=False): - LOG.debug(_("First checking, whether {!r} exists ...").format(self.config.template_vm)) - vm = self.vsphere.get_vm(self.config.template_vm, no_error=no_error) + LOG.debug(_("First checking, whether {!r} exists ...").format(self.tpl_vm_fqdn)) + vm = self.vsphere.get_vm(self.tpl_vm_fqdn, no_error=no_error) if vm: if self.verbose > 1: LOG.debug(_("Temporary VM {n!r} exists, raising {e}.").format( - n=self.config.template_vm, e='TempVmExistsError')) + n=self.tpl_vm_fqdn, e='TempVmExistsError')) if self.verbose > 2: - msg = "Info about Temporary VM {!r}:".format(self.config.template_vm) + msg = "Info about Temporary VM {!r}:".format(self.tpl_vm_fqdn) msg += '\n' + pp(vm.config) LOG.debug(msg) - raise TempVmExistsError(self.config.template_vm) + raise TempVmExistsError(self.tpl_vm_fqdn) LOG.debug(_("Temporary VM {!r} does not exists, will be created.").format( - self.config.template_vm)) + self.tpl_vm_fqdn)) # ------------------------------------------------------------------------- def get_temp_tpl_vm(self):