frapposelli / vagrant-vcenter

A Vagrant provider for VMware vCenter®
MIT License
106 stars 36 forks source link

Vagrant-vcenter doesn't add post-fix to template name as in rbvmomi #44

Open unklhe opened 7 years ago

unklhe commented 7 years ago

In vcenter_upload_box in inventory_check.rb, to check if a template exists the original template name is used. Refer to inventory_check.rb, line 50: cfg.template = cfg.datacenter.find_vm(box_to_search)

But in rbvmomi when it uploads template a post-fix #{@compute.name} will be added to the target template name. Refer to https://github.com/vmware/rbvmomi/blob/master/lib/rbvmomi/utils/deploy.rb , line 151 : vm_name = template_name+"-#{@computer.name}"

So when executing vagrant up, the result is, the template is uploaded successfully with a name "mytemplate-computename", but the VM can't be created because it still try to find template with name "mytemplate". Vagrant error : The Virtual Machine Template_folder/mytemplate was not found in this environment. This should not happen, please log an issue on Github

Workaround: after first vagrant up, rename mytemplate-computename to mytemplate, then re-execute vagrant up