Support nested VM folders

This commit is contained in:
Michael Kuzmin 2017-07-01 16:18:54 +03:00
parent 17f7a973d6
commit de58c87878
3 changed files with 4 additions and 2 deletions

2
.gitignore vendored
View File

@ -2,4 +2,6 @@
.glide/
vendor/
packer-builder-vsphere
packer-builder-vsphere.exe
bin/
test*.json

View File

@ -85,7 +85,7 @@ Post-processing:
"password": "{{user `vsphere_password`}}",
"template": "ubuntu",
"folder_name": "folder",
"folder_name": "folder1/folder2",
"vm_name": "vm-1",
"host": "esxi-1.domain.com",
"resource_pool": "pool1/pool2",

View File

@ -36,7 +36,7 @@ func (s *StepCloneVM) Run(state multistep.StateBag) multistep.StepAction {
ui.Say("start cloning...")
// Get folder
folder, err := finder.FolderOrDefault(ctx, s.config.FolderName)
folder, err := finder.FolderOrDefault(ctx, fmt.Sprintf("/%v/vm/%v", dc.Name(), s.config.FolderName))
if err != nil {
state.Put("error", err)
return multistep.ActionHalt