from .xlate import XLATOR
-__version__ = '3.1.6'
+__version__ = '3.1.7'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
# --------------------------------------------------------------------------
def create_instance_file(self, vm):
+ vs_name = vm.vsphere
+ vsphere = self.vsphere[vs_name]
+
fname = 'instance.' + vm.name + '.tf'
LOG.debug(_("Creating file {f!r} for VM instance {n!r}.").format(
f=fname, n=vm.name))
guest_id = self.config.guest_id
tpl_vm = None
if vm.vm_template:
- tpl_vm = self.vsphere_templates[vm.vm_template]
+ tpl_vm = self.vsphere_templates[vs_name][vm.vm_template]
if self.verbose > 3:
LOG.debug(_("Using template:") + "\n" + pp(tpl_vm))
- guest_id = 'data.vsphere_virtual_machine.{}.guest_id'.format(
- tpl_vm['tf_name'])
+ guest_id = 'data.vsphere_virtual_machine.{}.guest_id'.format(tpl_vm.tf_name)
else:
guest_id = '"' + guest_id + '"'