Skip to content

Commit

Permalink
1.5.3, Fix introduced bug when creating a bare-metal guest.
Browse files Browse the repository at this point in the history
  • Loading branch information
josenk committed Nov 3, 2019
1 parent c60a4ae commit a2e96ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ Configuration reference

Known issues with vmware_esxi
-----------------------------
* Using a local source vmx files should not have any networks configured. There is very limited network interface mapping abilities in ovf_tools for vmx files. It's best to simply clean out all network information from your vmx file. The plugin will add network configuration to the destination vm guest as required.
* terraform import cannot import the guest disk type (thick, thin, etc) if the VM is powered on and cannot import the guest ip_address if it's powered off.
* Only numvcpus are supported. numcores is not supported.
* Doesn't support CDrom or floppy.
Expand All @@ -205,6 +206,7 @@ Known issues with vmware_esxi

Version History
---------------
* 1.5.3 Fix introduced bug when creating a bare-metal guest.
* 1.5.2 Handle large userdata using scp. Connectivity test will retry only 3 times to help prevent account lockout.
* 1.5.1 Windows Fix for special characters in esxi password.
* 1.5.0 Support for Terraform 0.12, migrated examples to 0.12 format. Support to modify virtual_network & nic_type. Windows fixes.
Expand Down
12 changes: 7 additions & 5 deletions esxi/guest-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ func guestCREATE(c *Config, guest_name string, disk_store string,
boot_disk_vmdkPATH = fmt.Sprintf("\"/vmfs/volumes/%s/%s/%s.vmdk\"", disk_store, guest_name, guest_name)
remote_cmd = fmt.Sprintf("ls -d %s", fullPATH)
stdout, _ = runRemoteSshCommand(esxiSSHinfo, remote_cmd, "check if guest path already exists.")
if stdout == fullPATH {
fmt.Printf("Error: Guest path already exists. fullPATH:%s\n", fullPATH)
return "", fmt.Errorf("Guest path already exists. fullPATH:%s\n", fullPATH)
} else {
if strings.Contains(stdout, "No such file or directory") == true {
remote_cmd = fmt.Sprintf("mkdir %s", fullPATH)
stdout, err = runRemoteSshCommand(esxiSSHinfo, remote_cmd, "create guest path")
if err != nil {
log.Printf("Failed to create guest path. fullPATH:%s\n", fullPATH)
return "", fmt.Errorf("Failed to create guest path. fullPATH:%s\n", fullPATH)
}
} else {
fmt.Printf("Error: Guest path already exists. fullPATH:%s\n", fullPATH)
return "", fmt.Errorf("Guest path already exists. fullPATH:%s\n", fullPATH)
}

hasISO := false
Expand Down Expand Up @@ -149,7 +149,9 @@ func guestCREATE(c *Config, guest_name string, disk_store string,
log.Printf("[guestCREATE] New guest_name.vmx: %s\n", vmx_contents)

dst_vmx_file := fmt.Sprintf("%s/%s.vmx", fullPATH, guest_name)
vmx_contents, err = writeContentToRemoteFile(esxiSSHinfo, strings.Replace(vmx_contents, "\\\"", "\"", -1), dst_vmx_file, "write guest_name.vmx file")

remote_cmd = fmt.Sprintf("echo \"%s\" >%s", vmx_contents, dst_vmx_file)
vmx_contents, err = runRemoteSshCommand(esxiSSHinfo, 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)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module terraform-provider-esxi

require (
github.com/hashicorp/terraform v0.12.2
github.com/josenk/terraform-provider-esxi v1.5.2
github.com/josenk/terraform-provider-esxi v1.5.3
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.5.2
v1.5.3

0 comments on commit a2e96ff

Please sign in to comment.