Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix for datastores with spaces in their name. #108

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions vsphere/resource_vsphere_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ func resourceVSphereVirtualMachineUpdate(d *schema.ResourceData, meta interface{
diskPath = disk["vmdk"].(string)
case disk["name"] != "":
snapshotFullDir := mo.Config.Files.SnapshotDirectory
split := strings.Split(snapshotFullDir, " ")
split := strings.Split(snapshotFullDir, "] ")
if len(split) != 2 {
return fmt.Errorf("[ERROR] createVirtualMachine - failed to split snapshot directory: %v", snapshotFullDir)
}
Expand Down Expand Up @@ -992,7 +992,7 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{})
log.Printf("[DEBUG] resourceVSphereVirtualMachineRead - Analyzing disk: %v", diskFullPath)

// Separate datastore and path
diskFullPathSplit := strings.Split(diskFullPath, " ")
diskFullPathSplit := strings.Split(diskFullPath, "] ")
if len(diskFullPathSplit) != 2 {
return fmt.Errorf("[ERROR] Failed trying to parse disk path: %v", diskFullPath)
}
Expand Down Expand Up @@ -2024,7 +2024,7 @@ func (vm *virtualMachine) setupVirtualMachine(c *govmomi.Client) error {
diskPath = vm.hardDisks[i].vmdkPath
case vm.hardDisks[i].name != "":
snapshotFullDir := vm_mo.Config.Files.SnapshotDirectory
split := strings.Split(snapshotFullDir, " ")
split := strings.Split(snapshotFullDir, "] ")
if len(split) != 2 {
return fmt.Errorf("[ERROR] setupVirtualMachine - failed to split snapshot directory: %v", snapshotFullDir)
}
Expand Down