from .xlate import XLATOR
-__version__ = '2.9.2'
+__version__ = '2.9.3'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
LOG.info(_("Initialising VSPhere handlers."))
self.init_vspheres()
self.exec_collect_folders(yaml_file)
+ self.assign_default_vmw_values()
print()
LOG.info(_("Retrieving information from vSphere."))
except VSphereExpectedError as e:
raise ExpectedHandlerError(str(e))
+ # -------------------------------------------------------------------------·
+ def assign_default_vmw_values(self):
+ """Assigning not defined templates and clusters of VMs by their
+ appropriate default values."""
+
+ LOG.debug(_(
+ "Assigning not defined templates and clusters of VMs by their "
+ "appropriate default values."))
+
+ for vm in self.vms:
+
+ if not vm.cluster:
+ cl = self.config.vsphere[vm.vsphere].cluster
+ if self.verbose > 1:
+ LOG.debug(_("Setting cluster of {n!r} to {c!r} ...").format(
+ n=vm.name, c=cl))
+ vm.cluster = cl
+
+ if not vm.vm_template:
+ tpl = self.config.vsphere[vm.vsphere].template_name
+ if self.verbose > 1:
+ LOG.debug(_("Setting template of {n!r} to {t!r} ...").format(
+ n=vm.name, t=tpl))
+ vm.vm_template = tpl
+
# -------------------------------------------------------------------------·
def exec_vmw_clusters(self):
if self.stop_at_step == 'vmw-clusters':
self.incr_verbosity()
- self.vsphere.get_clusters()
+ for vname in self.vsphere:
+ self.vsphere[vname].get_clusters()
LOG.info(_("Finished step {!r}.").format('vmw-clusters'))
if self.stop_at_step == 'vmw-clusters':