diff --git a/README.md b/README.md index 1c91ae2..87c888b 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Terraform Provider Requirements ------------ -- [Terraform](https://www.terraform.io/downloads.html) 0.10.1+ +- [Terraform](https://www.terraform.io/downloads.html) 0.11.x+ - [Go](https://golang.org/doc/install) 1.11+ (to build the provider plugin) - [ovftool](https://www.vmware.com/support/developer/ovf/) from VMware. NOTE: ovftool installer for windows doesn't put ovftool.exe in your path. You will need to manually set your path. - You MUST enable ssh access on your ESXi hypervisor. @@ -271,11 +271,17 @@ Known issues with vmware_esxi * Using an incorrect password could lockout your account using default esxi pam settings. * Don't set guest_startup_timeout or guest_shutdown_timeout to 0 (zero). It's valid, however it will be changed to default values by terraform. +Donations +--------- +I work very hard to produce a stable, well documented product. I appreciate any payments or donations for my efforts. +* Bitcoin: 1Kt89337143SzLjSddkRDVEMBRUWoKQhqy +* paypal: josenk at jintegrate.co Version History --------------- -* 1.8.1 Fix, multimachine create on Windows. +* 1.8.2 Fix, Disk Stores containing spaces for bare-metal builds. +* 1.8.1 Fix, multimachine create on Windows. * 1.8.0 Add support for vswitch and portgroup resources. * 1.7.2 Correctly set numvcpu when using clone_from_vm that doesn't have a numvcpu key set. * 1.7.1 Bump release to include support for Terraform 0.13 diff --git a/esxi/guest-create.go b/esxi/guest-create.go index 0c7f207..81fdba4 100644 --- a/esxi/guest-create.go +++ b/esxi/guest-create.go @@ -71,7 +71,7 @@ func guestCREATE(c *Config, guest_name string, disk_store string, } else if src_path == "none" { // check if path already exists. - fullPATH := fmt.Sprintf("\"/vmfs/volumes/%s/%s\"", disk_store, guest_name) + fullPATH := fmt.Sprintf("/vmfs/volumes/%s/%s", disk_store, guest_name) boot_disk_vmdkPATH = fmt.Sprintf("\"/vmfs/volumes/%s/%s/%s.vmdk\"", disk_store, guest_name, guest_name) remote_cmd = fmt.Sprintf("ls -d %s", boot_disk_vmdkPATH) @@ -81,10 +81,10 @@ func guestCREATE(c *Config, guest_name string, disk_store string, return "", fmt.Errorf("Guest may already exists. vmdkPATH:%s\n", boot_disk_vmdkPATH) } - remote_cmd = fmt.Sprintf("ls -d %s", fullPATH) + remote_cmd = fmt.Sprintf("ls -d \"%s\"", fullPATH) stdout, _ = runRemoteSshCommand(esxiConnInfo, remote_cmd, "check if guest path already exists.") if strings.Contains(stdout, "No such file or directory") == true { - remote_cmd = fmt.Sprintf("mkdir %s", fullPATH) + remote_cmd = fmt.Sprintf("mkdir \"%s\"", fullPATH) stdout, err = runRemoteSshCommand(esxiConnInfo, remote_cmd, "create guest path") if err != nil { log.Printf("[guestCREATE] Failed to create guest path. fullPATH:%s\n", fullPATH) @@ -163,14 +163,14 @@ func guestCREATE(c *Config, guest_name string, disk_store string, dst_vmx_file := fmt.Sprintf("%s/%s.vmx", fullPATH, guest_name) - remote_cmd = fmt.Sprintf("echo \"%s\" >%s", vmx_contents, dst_vmx_file) + remote_cmd = fmt.Sprintf("echo \"%s\" >\"%s\"", vmx_contents, dst_vmx_file) vmx_contents, err = runRemoteSshCommand(esxiConnInfo, remote_cmd, "write guest_name.vmx file") // Create boot disk (vmdk) remote_cmd = fmt.Sprintf("vmkfstools -c %sG -d %s \"%s/%s.vmdk\"", boot_disk_size, boot_disk_type, fullPATH, guest_name) _, err = runRemoteSshCommand(esxiConnInfo, remote_cmd, "vmkfstools (make boot disk)") if err != nil { - remote_cmd = fmt.Sprintf("rm -fr %s", fullPATH) + remote_cmd = fmt.Sprintf("rm -fr \"%s\"", fullPATH) stdout, _ = runRemoteSshCommand(esxiConnInfo, remote_cmd, "cleanup guest path because of failed events") log.Printf("[guestCREATE] Failed to vmkfstools (make boot disk):%s\n", err.Error()) return "", fmt.Errorf("Failed to vmkfstools (make boot disk):%s\n", err.Error()) @@ -182,11 +182,11 @@ func guestCREATE(c *Config, guest_name string, disk_store string, log.Printf("[guestCREATE] Failed to use Resource Pool ID:%s\n", poolID) return "", fmt.Errorf("Failed to use Resource Pool ID:%s\n", poolID) } - remote_cmd = fmt.Sprintf("vim-cmd solo/registervm %s %s %s", dst_vmx_file, guest_name, poolID) + remote_cmd = fmt.Sprintf("vim-cmd solo/registervm \"%s\" %s %s", dst_vmx_file, guest_name, poolID) _, err = runRemoteSshCommand(esxiConnInfo, remote_cmd, "solo/registervm") if err != nil { log.Printf("[guestCREATE] Failed to register guest:%s\n", err.Error()) - remote_cmd = fmt.Sprintf("rm -fr %s", fullPATH) + remote_cmd = fmt.Sprintf("rm -fr \"%s\"", fullPATH) stdout, _ = runRemoteSshCommand(esxiConnInfo, remote_cmd, "cleanup guest path because of failed events") return "", fmt.Errorf("Failed to register guest:%s\n", err.Error()) } diff --git a/version b/version index 2fb69e1..57f5271 100644 --- a/version +++ b/version @@ -1 +1 @@ -v1.8.1 +v1.8.2