Commit Graph

214 Commits

Author SHA1 Message Date
Matthew Hooker a831d522be
change run signatures
Run now takes a context as well as a statebag. We'll assign the context
to the blank identifier to prevent namespace collisions. We'll let the
step authors opt-in to using the context.

`find . -iname "step_*.go" -exec gsed -i'' 's/func \(.*\)Run(/func \1Run(_ context.Context, /' {} \;`
2018-01-24 17:09:17 -08:00
Matthew Hooker 366dc3da0a
move multistep imports to helper.
gomvpkg -from "github.com/mitchellh/multistep" -to "github.com/hashicorp/packer/helper/multistep"
2018-01-24 17:09:15 -08:00
Matthew Hooker ebe995c0ff
run goimports 2018-01-22 17:21:10 -08:00
Andrew Pennebaker d069dc5b7c handle holding a-z keys, such as for boot options (vmware builder) 2017-12-09 20:51:49 -06:00
Andrew Pennebaker 4acc98a729 add super key (vmware builder) 2017-12-07 23:15:56 -06:00
Matthew Hooker 4d117bf117
Make vm log output less confusing 2017-11-02 10:45:54 -07:00
Matthew Hooker 07b013945f
more consistent flag name 2017-10-12 16:38:18 -07:00
Matthew Hooker 106408f6be
add new disable_vnc option 2017-10-12 16:34:40 -07:00
nictrix 6a238a3ef3
add option to skip vnc phase and update docs 2017-10-12 16:28:27 -07:00
Michael Kuzmin 9876a28ea7 vmware: publish vm_name as artifact ID 2017-07-28 11:16:46 +03:00
Matthew Hooker bf830e393d Merge pull request #4810 from bryonr/fix_vmware_shutdown_cleanup_osx
Help ensure VMX builder properly removes mounted CDs on OS X
2017-06-05 15:17:08 -07:00
James Nugent c4439aba82 builder/vmware: Add vmx_remove_ethernet_interfaces
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.
2017-05-24 18:53:25 -05:00
JD Friedrikson a0052fdb68
Specify InsecureIgnoreHostKey for HostKeyCallback
[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.
2017-05-20 16:17:04 -04:00
Matthew Hooker 9f992b8f80
go files are 0644 2017-04-25 12:50:58 -07:00
Bryon Ross d092044834 Help ensure VMX builder properly removes mounted CDs on OS X
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.
2017-04-19 16:27:16 -07:00
Matthew Hooker 81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Matthew Hooker 1fa643e88d Merge pull request #4498 from mitchellh/f-simple-passwords
Reduce character set for passwords
2017-02-02 15:04:02 -08:00
Matthew Hooker 70af3d8148 Merge pull request #4497 from mitchellh/f-clickable-links
Make rdp and vnc links clickable by adding the protocol
2017-02-02 12:41:59 -08:00
Chris Bednarski dcb4b50dbf Reduce character set for passwords
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
2017-02-02 04:03:46 -08:00
Chris Bednarski facf27ceeb Make rdp and vnc links clickable by adding the protocol 2017-02-02 01:55:28 -08:00
Matthew Hooker 22d1322bd9
always check for an error first when walking a path 2017-01-26 16:32:21 -08:00
Matthew Hooker f1175c1921
parallels/vmware: don't wait for shutdown command.
Resolves #4134

replaces/ closes #4379

Leaving Hyper-V builder alone for now until we can get a case that reproduces.
2017-01-20 01:44:18 -08:00
Matthew Hooker 0a46d883df Merge pull request #4409 from mitchellh/httpenvvar
set PACKER_HTTP_ADDR env var when available.
2017-01-18 12:35:14 -08:00
Rickard von Essen 81ad800fb6 builder/vmware: Try to use `ip address` to find host IP
Closes #4406
2017-01-17 10:33:48 +01:00
Matthew Hooker d2e59e4e92
set PACKER_HTTP_ADDR env var when available.
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
2017-01-16 23:19:52 -08:00
Chris Bednarski 6ad702ad74 Update comments to reflect current implementation 2017-01-14 20:11:51 -08:00
Chris Bednarski ee2d636840 Improve delay between key events
- 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
2017-01-14 17:56:04 -08:00
Chris Bednarski d0c64f90d5 Read key interval from ENV; default to 100ms 2017-01-14 16:52:37 -08:00
Chris Bednarski da083506f1 Reduce key delay to 10ms to boot times are a lot faster 2017-01-14 16:52:24 -08:00
febc.yamamoto 6088c1887c Fix keycodes for ctrl,shift and alt key when sending over VNC 2016-11-04 19:26:14 +09:00
Matthew Hooker d920b3fbf4 run gofmt 2016-11-01 14:08:04 -07:00
Matthew Hooker d6bed79429 wait for shutdown command to end so we get stderr/out 2016-10-22 10:33:27 -07:00
Matthew Hooker e9a5d05a2f builder/vmware: Ignore shutdown errors
Resolves issue where `shutdown_command` would error because the remote
side disconnected, which we should have expected and ignored.
2016-10-21 22:41:45 -07:00
Matthew Hooker f9f47c5bbb fix shell disconnect error when shutting down vmware 2016-10-21 22:26:34 -07:00
Matthew Hooker badadec140 Merge pull request #3758 from elconas/fix_vmware_builder
Fix License check to work with licensed VMware Workstation
2016-10-07 17:51:32 -07:00
Matthew Hooker a8e57d83d2 gofmt project.
noticed many unrelated changes being added to patches because of gofmt.

ran `find . -not -path "./vendor/*" -name "*.go" -exec gofmt -w {} \;`
2016-09-29 14:13:06 -07:00
Rickard von Essen 06e3539ffa Merge pull request #3767 from taliesins/ExtendScanCodes
Add support for ctrl, shift and alt keys and using them as key modifier.
2016-09-20 21:36:46 +02:00
Rickard von Essen 3e1aed9a6f Enable to disable vnc password for VMware builder 2016-08-19 13:26:23 +02:00
Israel Shirk f961ce701b Adds password protection for VNC on VMWare 2016-08-19 13:26:16 +02:00
mahcsig 832d45023b Re-introduce case sensitive vmx key functionality (#2707)
Add case sensitive vmx key functionality
2016-08-19 13:23:07 +02:00
Charlie Vieth 6ce847e720 Do not add remotedisplay.vnc.ip to vmx data on ESXi
* 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>
2016-08-19 13:19:04 +02:00
Taliesin Sisson 1155c6d4d6 Use the correct fmt verb for log output 2016-07-31 19:46:38 +01:00
Taliesin Sisson a87ad05866 Add support for ctrl, shift and alt keys.
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.
2016-07-31 19:05:10 +01:00
Robert Heinzmann 3a700414ca Fix License check to work with licensed vmware player 2016-07-28 10:42:58 +02:00
Ian Duffy 0327f6c935 Allow configurable VNC bind IP for VMware builders
Signed-off-by: Ian Duffy <ian@ianduffy.ie>
2016-05-23 14:07:03 +01:00
Sean Chittenden 9b3f8a4be9
Pause between boot_commands when debugging a VMware build
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
```
2016-05-17 03:50:00 -04:00
James Bishopp bd8fb014c4 Removed ssh_key_path
- removed backwards compatibility code
- ensured key usage came from SSHPrivateKey configuration
- changed tests to use private_key
2016-02-12 17:24:42 -08:00
Chris Bednarski 24dc798cfb Revert "Prevalidate Hardware Specs on Linux"
This reverts commit eda84cb2d3.
2016-02-02 12:41:43 -08:00
Chris Bednarski 6504f4f777 Revert "Only validate vmware resources on local hosts"
This reverts commit f01578c91e.
2016-02-02 12:41:42 -08:00
Chris Bednarski 7ad2104c7f Revert "Correctly call prepare function in test"
This reverts commit 6e8bfd3ce9.
2016-02-02 12:41:37 -08:00
Jake Champlin 6e8bfd3ce9 Correctly call prepare function in test 2016-01-25 12:54:15 -05:00
Jake Champlin f01578c91e Only validate vmware resources on local hosts
Disable resource validation when `remote_type` is specified
2016-01-25 12:01:56 -05:00
Jake Champlin eda84cb2d3 Prevalidate Hardware Specs on Linux
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
```
2016-01-21 18:19:11 -05:00
Mark Peek 7f149e595d Refactor http server config into common 2015-11-01 14:45:47 -08:00
Yuya Kusakabe 699c673536 builder/vmware-esxi: Add step_export
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.
2015-10-23 09:00:53 +09:00
Chris Bednarski 313fcaf0ff Revert backwards-compatibility break in VMX option casing
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
2015-08-10 14:52:34 -07:00
Chris Bednarski 263641c537 Fix case for ethernet.generatedAddress property lookup in VMX 2015-08-01 15:09:59 -07:00
Chris Bednarski f8cfd0a1cb Merge pull request #2309 from marc-ta/casesensitivevmxkeys
Updated how vmx entries are handled
2015-07-30 14:31:54 -07:00
Bob Kuo 585638d063 Do not require exclusive VNC access while buildling
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.
2015-07-29 10:00:09 -05:00
Marc Siegfriedt e9ef2b987e fixed the test as well 2015-07-01 15:11:40 -07:00
Marc Siegfriedt df1be999dc Fixed case sensitive issue with VMX entries not being overwritten 2015-07-01 15:11:40 -07:00
Marc Siegfriedt 1d7d490c01 updated how vmx entries are handled 2015-07-01 15:11:40 -07:00
Mitchell Hashimoto 9bc0dfa389 builder/vmware: disable VNC before packaging 2015-06-22 14:50:25 -07:00
Mitchell Hashimoto b7dab2689a fmt 2015-06-18 05:23:04 +02:00
Alexander Golovko 15f40a3d00 fix disabling vmware tools for ESX 2015-06-15 15:08:56 -07:00
Mitchell Hashimoto 70af21615e Merge pull request #2233 from mitchellh/b-output-dir
builder/virtualbox,vmware: validate output dir in step
2015-06-15 09:40:36 -07:00
Mitchell Hashimoto 115d583cff helper/communicator: make host more generic 2015-06-13 19:23:33 -04:00
Mitchell Hashimoto b61ed3adfc builder/vmware: convert to helper/comm 2015-06-13 18:52:44 -04:00
Mitchell Hashimoto d851898131 builder/vmware: mirror virtualbox output dir changes 2015-06-13 17:00:14 -04:00
Mitchell Hashimoto 3ba9d70b22 Merge pull request #1382 from sneal/AdditionalDisksForVMwareISO
Additional disks for vmware iso
2015-06-10 12:39:50 -07:00
Mitchell Hashimoto fafdfc962f vmware/common: detect Vmware 'unknown error' and show better message 2015-06-10 11:31:36 -07:00
Mitchell Hashimoto 23a48d6619 go fmt 2015-06-08 21:34:20 -07:00
Mitchell Hashimoto fa2bcb8bc5 update CHANGELOG 2015-06-08 21:33:53 -07:00
Mitchell Hashimoto 2373640881 Merge pull request #1663 from beezly/fix-vnc-missed-keys
Add 1/10th second delay between key events to VNC
2015-06-08 21:31:55 -07:00
Mitchell Hashimoto 9f0b8b71db virtualbox,vmware: http server should listen on IPv4 2015-06-08 20:47:47 -07:00
Eric Richardson 5f183026b3 Fix vmware compact_disk step when there are no additional disks 2015-06-04 08:22:50 -07:00
Eric Richardson fab9ca9cdb Initial work to implement additional disk support in the vmware-iso builder
* Matches the syntax from mitchellh/packer#703
* Creates disk(s), adds them to the vmx template, and runs compact at the end
2015-06-04 08:22:50 -07:00
Mitchell Hashimoto 7e74a38ff8 Merge pull request #2000 from cyberhouse/ifconfig-regex
Make the Vmware build extract the host IP properly from ifconfig stdout
2015-05-28 09:39:32 -07:00
Mitchell Hashimoto 7bd618b56b Merge pull request #1989 from marcomorain/upper-case-mac-address
Fix for VMWare on OSX – MAC address can be upper or lower case
2015-05-28 09:38:23 -07:00
jszwedko b1497b951c code.google.com/p/go.crypto/ssh -> golang.org/x/crypto/ssh
code.google.com/p/go.crypto/ssh is now at golang.org/x/crypto/ssh as of
https://code.google.com/p/go/source/detail?spec=svn.crypto.69e2a90ed92d03812364aeb947b7068dc42e561e&repo=crypto&r=8fec09c61d5d66f460d227fd1df3473d7e015bc6

Using the code.google.com import redirects properly, but runs into
issues if you try to use a subpackage of `ssh`, e.g. `agent` which
refers to golang.org/x/crypto/ssh causing conflicts if your types expect
code.google.com/p/go.crypto/ssh.

This is a precursor to a PR for #1066.
2015-05-28 08:17:49 -07:00
Mitchell Hashimoto 4bb16ac223 fix failing tests 2015-05-27 14:30:59 -07:00
Mitchell Hashimoto f5945eeb1b vmware/iso: new interpolation 2015-05-27 14:16:28 -07:00
Georg Großberger 8c0169b1c4 Make the Vmware build extract the host IP properly from ifconfig stdout 2015-03-25 14:45:15 +01:00
Marc O'Morain 9b2d219cab MAC address can be upper or lower case 2015-03-18 16:40:05 +00:00
Andrew Beresford a81c8905fb Add 1/10th second delay between key events to VNC 2015-03-09 13:58:46 +00:00
Emil Hessman fdb64f6f25 builder/vmware/common: fix missing format argument for Fatalf call in test
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
2015-02-25 05:43:17 +01:00
Mitchell Hashimoto 0db6cd3533 Merge pull request #1330 from qur/qemu-vagrant
Qemu vagrant
2014-10-28 08:42:17 -07:00
Mitchell Hashimoto cdc0a53f92 builder/vmware: fix compilation issues 2014-10-28 08:37:12 -07:00
Mitchell Hashimoto e422a45449 fmt 2014-10-28 08:35:21 -07:00
Mitchell Hashimoto fc5db2604e builder/vmware: FUSION_APP_PATH to specify path [GH-1552] 2014-10-28 08:21:39 -07:00
Shawn Neal 5fd9651982 GH 1508 - Ensure Packer VMX is updated and saved
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.
2014-09-24 09:42:10 -07:00
Julian Phillips 90a57c411f Expand Artifact API to expose build state
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.
2014-09-22 11:15:47 +01:00
Shawn Neal 7d9c252b3a Clean VMX step should always remove floppy.
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.
2014-09-16 18:27:00 -07:00
Ross Smith II a7aa20c8c7 Add support for VMware Fusion 7 Pro [GH-1478] 2014-09-10 10:14:50 -07:00
Mitchell Hashimoto 75395af12d Merge branch '1064-fix-upload-file-permissions' of github.com:rasa/packer into rasa-1064-fix-upload-file-permissions
Conflicts:
	builder/parallels/common/step_upload_parallels_tools.go
	builder/vmware/common/step_upload_tools.go
	provisioner/chef-client/provisioner.go
	provisioner/chef-solo/provisioner.go
2014-09-08 13:20:46 -07:00
Mitchell Hashimoto 812ba35479 fmt 2014-09-08 10:28:21 -07:00
Mitchell Hashimoto 1a45b96674 builder/vmware: add VNC to vmx 2014-09-05 12:10:40 -07:00
Mitchell Hashimoto b72605c2f6 builder/vmware: style 2014-09-05 12:01:07 -07:00
Mitchell Hashimoto 759c46487c builder/vmware-vmx: support http files 2014-09-05 11:59:46 -07:00
Mitchell Hashimoto c74f0c7cfe Merge branch '1082-add-boot-commands-to-vmx-and-ovf-builders' of github.com:rasa/packer into rasa-1082-add-boot-commands-to-vmx-and-ovf-builders
Conflicts:
	builder/virtualbox/ovf/config.go
	builder/vmware/vmx/config.go
2014-09-05 11:42:01 -07:00