From e57a09d886425caf8fad8b4c2dc258a5e7c07a00 Mon Sep 17 00:00:00 2001 From: Nicholas Geyer Date: Thu, 20 Jul 2017 17:32:37 -0500 Subject: [PATCH 1/4] modified split to use '] ' to grab diskPath --- vsphere/resource_vsphere_virtual_machine.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsphere/resource_vsphere_virtual_machine.go b/vsphere/resource_vsphere_virtual_machine.go index 15e291a38..a36cc6bd9 100644 --- a/vsphere/resource_vsphere_virtual_machine.go +++ b/vsphere/resource_vsphere_virtual_machine.go @@ -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) } From 02a24c0f731af5afb8280ed6a4db2fbd41a85725 Mon Sep 17 00:00:00 2001 From: Nicholas Geyer Date: Mon, 24 Jul 2017 11:47:54 -0500 Subject: [PATCH 2/4] Learning fork and branch with go and git --- test | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test diff --git a/test b/test new file mode 100644 index 000000000..e69de29bb From 46c316fe086d0e3029e1d38266ca2c0ac8b2ddb0 Mon Sep 17 00:00:00 2001 From: Nicholas Geyer Date: Mon, 24 Jul 2017 14:27:06 -0500 Subject: [PATCH 3/4] added more support for datastores with spaces Specifically modified the Split method on snapshotFullDir to use "] " rather than simply " ". --- vsphere/resource_vsphere_virtual_machine.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vsphere/resource_vsphere_virtual_machine.go b/vsphere/resource_vsphere_virtual_machine.go index a36cc6bd9..2fe220377 100644 --- a/vsphere/resource_vsphere_virtual_machine.go +++ b/vsphere/resource_vsphere_virtual_machine.go @@ -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) } @@ -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) } From 6d2bb3c7b3e6961c4e4e1a64fcb10250efddfaea Mon Sep 17 00:00:00 2001 From: Nicholas Geyer Date: Mon, 24 Jul 2017 18:58:39 -0500 Subject: [PATCH 4/4] removed test file --- test | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test diff --git a/test b/test deleted file mode 100644 index e69de29bb..000000000