This commit adds a new option, `vmx_remove_ethernet_interfaces`, to both
of the VMWare builders. This is useful when building Vagrant boxes,
since Vagrant now produces output such as:
```
WARNING: The VMX file for this box contains a setting that is
automatically overwritten by Vagrant when started. Vagrant will stop
overwriting this setting in an upcoming release which may pre vent
proper networking setup. Below is the detected VMX setting:
ethernet0.pcislotnumber = "33"
If networking fails to properly configure, it may require this VMX
setting. It can be manually applied via the Vagrantfile:
Vagrant.configure(2) do |config|
config.vm.provider :vmware_fusion do |vmware|
vmware.vmx["ethernet0.pcislotnumber"] = "33"
end
end
```
This can be avoided entirely by removing the ethernet adapters from the
VMX file prior to packaging as a Vagrant box, in which case adapters are
created as expected according to the Vagrantfile specification.
[A recent breaking change upstream in Golang's crypto
library](e4e2799dd7)
has broken SSH connectivity for a few builders:
```
==> qemu: Waiting for SSH to become available...
2017/05/20 16:23:58 ui: ==> qemu: Waiting for SSH to become available...
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 [INFO] Attempting SSH connection...
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 reconnecting to TCP connection for SSH
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 handshaking with SSH
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 handshake error: ssh: must specify HostKeyCallback
2017/05/20 16:23:58 packer: 2017/05/20 16:23:58 [DEBUG] SSH handshake err: ssh: must specify HostKeyCallback
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 [INFO] Attempting SSH connection...
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 reconnecting to TCP connection for SSH
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 handshaking with SSH
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 handshake error: ssh: must specify HostKeyCallback
2017/05/20 16:24:05 packer: 2017/05/20 16:24:05 [DEBUG] SSH handshake err: ssh: must specify HostKeyCallback
```
Specifying HostKeyCallback as insecure should make things work again
and would make sense for packer's use case.
Pull request 1504 describes a workaround for a potential race condition in which the VMX builder can fail to remove mounted floppies or CDs. This workaround was enabled for all operating systems except OS X. Since this issue can also occur on OS X, also apply the workaround on it.
At the beginning of each VMware build packer generates a random VNC password and prints it to the terminal / log. When copying a password from a terminal emulator with double-click, the text selection uses word boundaries to attempt to automatically detect where the password string is located. When the password contains weird characers like %^&# this parsing fails and you only get half the password. The reduction in characters does not significantly reduce the entropy of the password but improves user-friendliness when you actually want to use it.
Also deletedsome unused files
If using a builder that has an http server set up for file transfer,
expose the connection info to the shell provisioner through the environment
variable PACKER_HTTP_ADDR.
Closes#2869
- Can now tune delay using PACKER_KEY_INTERVAL
- Added implementation to all of VMware and QEMU
- Removed double delay for QEMU
- Default key delay of 100ms (as before)
- Added docs to QEMU and VMware pages
* The remotedisplay.vnc.ip vmx data key breaks ESXi, this commit prevents it
from being automatically added during VNC configuration when using the ESX5
driver.
* It can still be configured via the vmx_data section of the builder
template
Signed-off-by: Sunjay Bhatia <sbhatia@pivotal.io>
Add support for using ctrl, shift and alt as key modifiers. So you can now achieve ctrl+c by using "<leftCtrlOn>c<leftCtrlOff>".
Updated documentation for new key stroke tokens.
When debugging a build (or maintaining an existing packer file), teach `packer build -debug` how to step through individual `boot_command`s in order to triage the packer file.
```
==> vmware-iso: Typing the boot command over VNC...
==> vmware-iso: Pausing after run of step 'boot_command[0]: <enter><wait>'. Press enter to continue.
==> vmware-iso: Pausing after run of step 'boot_command[1]: <enter><wait>'. Press enter to continue.
==> vmware-iso: Pausing after run of step 'boot_command[2]: freebsd-vagrant<enter><wait>'. Press enter to continue.
==> vmware-iso: Pausing after run of step 'boot_command[3]: <down><spacebar>'. Press enter to continue. ^C
```
Prevalidates hardware resources on Linux platforms for Virtualbox and
VMware builders. This is currently only available on Linux, as enabling
for both Darwin and Windows platforms, relies on cgo bindings that would
prevent effective cross-compilation.
Packer will now fail to build and validate templates if the template is
requesting that the VM to be created would allocate more system
resources than the host system has available.
This _however_ doesn't catch parallel builds that overflow the hosts
resources, will probably still need a better error message for VM's
failing to boot in that case.
Example Outputs:
```
$ $GOPATH/bin/packer build -debug ./vmware-iso.json
Debug mode enabled. Builds will not be parallelized.
vmware-iso output will be in this color.
2 error(s) occurred:
* Unavailable Resources: RAM - Requested - 204800000MB - Available 21721MB
* Unavailable Resources: Disk - Requested - 4000000000MB - Available 76701MB
```
```
$ $GOPATH/bin/packer build -debug ./vbox-iso.json
Debug mode enabled. Builds will not be parallelized.
virtualbox-iso output will be in this color.
2 error(s) occurred:
* Unavailable Resources: RAM - Requested - 10240000MB - Available 21721MB
* Unavailable Resources: Disk - Requested - 1000000000MB - Available 76701MB
```
If `format` option is configured, packer exports the VM with ovftool.
website: Document about OVF Tool and `format` option.
post-processor/vsphere: Enable to use `mitchellh.vmware-esx` artifact type and OVF and OVA formats, fixes#1457.
PR #2309 introduced case-sensitive options in VMX files. This is to support a case-sensitive option called `virtualSSD`. The change made all options case-sensitive, which causes problems with external VMX options provided in user templates. To prevent breakage, this change is being reverted.
- Fixes#2574
- Reverts #2542
- Reverts #2309
An additional client can be connected during build time for inspection.
We can manually connect and set our VNC clients to ignore all input or
we can connect with vnc2flv to record the build session for later
verification.
Fixes the following vet report:
builder/vmware/common/step_shutdown_test.go:130: missing argument for Fatalf("%s"): format reads arg 1, have only 0 args
We need to ensure the VMWare process has exited before attempting to run VMX file cleanup steps, otherwise VMWare may overwrite our changes. While Packer does its best to ensure VMWare has exited, there's still a race condition on some OSs between VMWare flushing the VMX and Packer updating it. The workaround is to artifically wait 5 seconds.
When using the VMX builder its possible for the source machine to have a floppy and/or CD-ROM mounted which gets cloned to the new VM Packer spins up, but have no Packer configuration for those devices. With this change we always attempt to remove the mounted devices regardless of the Packer configuration.
In order that something consuming an artifact can have access to extra
builder specific data add the State method which allows the caller to
ask for arbitary values by name.
When using the VMX builder its possible for the source machine to have a floppy configured which gets cloned to the new VM Packer spins up. When the new VM's Packer config doesn't have a floppy_files config entry, the Packer clean VMX step fails to remove the floppy disk from the new VM. This can cause build failures, for example with the vsphere post processor; generating errors like:
* Post-processor failed: Failed: exit status 1
Error: File (/home/teamcity/tmp/buildTmp/packer941120499) could not be found.
Opening the cloned VM's VMX file you can clearly see it has a floppy entry from the source machine's VMX file (exact same path) even though the Packer config contains no floppy_files entry.