Commit Graph

576 Commits

Author SHA1 Message Date
Ali Rizvi-Santiago 15cb6a833a Ugh..missing argument in VMware builder's driver_esx5 unit-test due to api change for .HostIP(). Fixed. 2018-02-02 19:11:41 -06:00
Ali Rizvi-Santiago 9b95ce0bc6 Completely forgot to support the unix paths in each of the drivers for the VMware builder. Fixed. 2018-02-02 19:11:41 -06:00
Ali Rizvi-Santiago 4225b3568e Fixed bad ORs and a bad fmtstring. 2018-02-02 19:11:41 -06:00
Ali Rizvi-Santiago 75d3ea7cee Added support for sound, serial ports, parallel ports, usb, and specifying a default network to the vmware builder.
builder/vmware/{iso,vmx}:
    Added the specific configuration options that get parsed.
    Normalize paths when pulling them from the json template so that they'll work on Windows too.
    Added some improved error checking when parsing these options.
    Stash the vm's network connection type so that other steps can figure out addressing information
    Modified the esx5 driver to support the new addressing logic.
    Modified the template in step_create_vmx to include the new options.

builder/vmware/common:
    Implemented a parser for vmware's configuration files to the vmware builder.
    Modified the driver's interface to include support for resolving both guest/host hw and ip addresses
    Implemented a base structure with some methods that implement these features.
    Rewrote all ip and mac address dependent code to utilize these new methods.
    Removed host_ip and guest_ip due to their logic being moved directly into a
        base-structure used by each driver. The code was explicitly checking runtime.GOOS
        instead of portably using net.Interfaces() anyways.
    Updated driver_mock to support the new addressing methods
2018-02-02 19:11:41 -06:00
SwampDragons 8ae8f31a52
Merge pull request #5681 from mcandre/super-key
add super key (vmware builder)
2018-02-02 13:33:11 -08:00
Matthew Hooker 8bdd3b45c7
use helper functions for reading vmx files 2018-01-31 13:19:31 -08:00
Matthew Hooker 76b2ce8604
log which vmware driver we decide on 2018-01-26 16:12:43 -08:00
Matthew Hooker 07421b4433
test vmware workstation version checking 2018-01-26 15:58:17 -08:00
Matthew Hooker 8cd403425e
test fixes WIP 2018-01-24 17:09:17 -08:00
Matthew Hooker 7a189a83a1
fix imports
`find . -type f -name '*.go' -not -path "./vendor/*" -exec goimports -w {} \;`
2018-01-24 17:09:17 -08:00
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
SwampDragons 8a30b3db80
Merge pull request #5456 from GoSecure/vmware-iso-improved-network-logging
vmware-iso builder: Logging on network errors on connection refused
2017-11-30 16:31:30 -08:00
bugbuilder 23f4d187e2 validating keep_registered and fixing skip_export issues 2017-11-08 15:57:34 -03:00
Matthew Hooker 4d117bf117
Make vm log output less confusing 2017-11-02 10:45:54 -07:00
Olivier Bilodeau 820811675d vmware-iso builder: Logging on network errors on connection refused 2017-10-13 19:00:48 -04: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
Matthew Hooker 2a326b5172
fix nil ptr exception 2017-10-05 16:34:13 -07:00
Megan Marsh e93d64e80f Merge pull request #4592 from jimmythedog/ovfexportpath-localoutputdir
Ovfexportpath localoutputdir -- Merging for release with 1.1.0
2017-08-31 09:55:58 -07:00
Matthew Hooker cd11e4ff33 Merge pull request #5187 from mkuzmin/vmware-artifactid
vmware: Publish artifact ID
2017-08-30 13:56:49 -07:00
Matthew Hooker 28894fb418 Merge pull request #5274 from mmerdes/master
Fix timestamp interpolation in created file name
2017-08-23 14:08:27 -07:00
Victor Ronin cb75796389 Show a message why VM export was skipped while building on VMWare Fusion/Workstation 2017-08-23 12:44:46 -07:00
Matthias Merdes c8d09b5152 Fix timestamp interpolation in created file name
This commit attempts to fix the timestamp-related part of #4885 by using the logic found in the analogous virtualbox implementation. In essence, it applies the solution from commit 93bb0d8 to the vmx case.
2017-08-23 13:04:42 +02:00
Michael Kuzmin 9876a28ea7 vmware: publish vm_name as artifact ID 2017-07-28 11:16:46 +03:00
Matthew Hooker d35eeecf46
vnc port discovery timeout is 15 seconds 2017-06-22 17:58:18 -07:00
Megan Marsh 2a6f5f1b13 specify HostKeyCallback for vmware esx5 driver 2017-06-21 10:09:11 -07: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
Matthew Hooker 730cc0889e Merge pull request #4919 from hashicorp/fix4798
builder/vmware: make vnc probe timeout configurable
2017-05-30 12:59:22 -07:00
Matthew Hooker f801c507fc
builder/vmware: make vnc probe timeout configurable 2017-05-30 12:51:45 -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 4fcbf75da9
s/non existent/nonexistent/ 2017-03-29 12:38:33 -07:00
Matthew Hooker d1b20b3d9c
remove a bunch of dead code.
https://github.com/dominikh/go-tools/tree/master/cmd/unused
2017-03-28 20:36:20 -07:00
Matthew Hooker 230079f73a
spell fixes 2017-03-28 20:36:19 -07:00
Jimmy The Dog 1e9b0f7b8f Replace export output dir in state bag with params
step_export now has the OutputDir as a param instead of getting it from
the state bag, on the advice of @mwhooker in PR comment
2017-03-10 10:43:45 +00:00
Jimmy The Dog e851efb1b6 Set export_dir to the output_dir property 2017-03-10 08:20:48 +00:00
Jimmy The Dog 9eb9abdce9 Merge branch 'master' into ovfexportpath-localoutputdir 2017-03-10 08:12:26 +00:00
Matthew Hooker 8cc2ed7d6e
vmware/esx: try for longer to connect to vnc port 2017-02-28 22:21:19 -08:00
Matthew Hooker ed92055372 Merge pull request #4532 from mitchellh/vmipgetagain
builder/vmware: don't cache ip address so we know if it changes
2017-02-26 18:46:46 -08:00
Jimmy The Dog ce41055ac6 builder/vmware-iso: do not append to output dir, as ovftool does that 2017-02-24 14:49:40 +00:00
Jimmy The Dog 14810523b8 builder/vmware-iso: get artifact files from local dir 2017-02-24 14:48:38 +00:00
Jimmy The Dog 7a2b30dcc4 builder/vmware-iso: need to always set local output dir, or non-remote build exports will fail 2017-02-24 13:18:28 +00:00
Jimmy The Dog f8df5f81db builder/vmware-iso: set local output dir 2017-02-24 12:46:00 +00:00
Marc Carmier 5c11a2e594 Add test for empty remote_type value 2017-02-15 22:11:27 +01:00
Marc Carmier 86c0c859c5 Validate the remote_type value for builder/vmware-iso 2017-02-15 22:04:28 +01:00
Matthew Hooker 0ed84f843e
builder/vmware: allow extra options for ovftool 2017-02-10 00:22:20 -08:00
Matthew Hooker 29dd20da68
builder/vmware: don't cache ip address so we know if it changes 2017-02-09 23:16:40 -08: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
Jelle Hissink 6973e752d2 Vmware vsphere vnc port timeout increased 2017-01-29 14:41:14 +01:00
Matthew Hooker 22d1322bd9
always check for an error first when walking a path 2017-01-26 16:32:21 -08:00
Matthew Hooker 56c5628205
builder/vmware-iso: set ovftool output path 2017-01-23 17:47:35 -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
DanHam c7e8d671a9
Add option to skip export of installed VM for VMware iso builder 2017-01-10 11:44:11 +00:00
Mikhail Zholobov 57d07f227a
Add "iso_target_extension" option for all local *-iso builders
This option allows to set the extension of the ISO file after download.
Defaults to "iso". It makes sense for building Mac OS X guests, where the
bootable image is actually a DMG, not an ISO.
In particular, it is important for "parallels-iso" builder to set the right extension.
2016-12-17 12:50:30 +02: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
Rickard von Essen 3c8dabba9e Fixed formatting 2016-10-11 23:43:50 +02:00
Rickard von Essen 5e96709ee9 Merge pull request #2919 from arizvisa/floppy-recurse
Added an option for copying entire subdirectories via floppy_dirs (supplants floppy_files)
2016-10-08 16:51:16 +02: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
Ali Rizvi-Santiago 86c00490e9 Renamed any and all instances of the word "FloppyContents" to "FloppyDirectories".
Ensure that all builders include FloppyDirectories in the StepCreateFloppy options.
Changed the way the unit-tests in common/step_create_floppy_test work to use the static test-fixtures directory instead of creating the paths dynamically.
Removed a duplicate line of documentation from parallels-pvm.html.md that occurred during rebasing.
2016-09-27 23:31:42 -05: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
Orivej Desh 6762965696 Add -on-error command line argument to allow preserving artifacts on builder errors
Resolves #409
2016-09-16 12:15:00 +00:00
Ali Rizvi-Santiago a3f0308e92 Re-implemented the support for the floppy_files keyword in order to remain backwards-compatible with templates using the old syntax.
Moved the support for recursive paths from the floppy_files keyword to the new floppy_contents keyword.
Shifted some of the code around to add better logging of what's actually being copied.
Added a couple of unit-tests for the new floppy_contents implementation.
Ensured that all files that were being added were also being included in state.FilesAdded so that the older unit-tests will work.
2016-09-12 11:56:25 -05:00
Rickard von Essen 5cbc36103e Merge pull request #3756 from ricardclau/floppy_check
Test floppy disks actually exist
2016-09-12 08:05:16 +02:00
Marc Siegfriedt c1e129848c 3833 - fix for port in MR3347 2016-08-26 20:58:04 +00:00
Rickard von Essen 6cd7ad82bb Fixed dupliceted test 2016-08-19 14:34:24 +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
Jeremiah Roth 9489c83f0f If the VM has more than one NIC, loop through until we find one that works (#3347) 2016-08-19 13:23:43 +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
Dan Tran 4ac6e2a08c Dont check for poweron command error to force retry at state check (#3195) 2016-08-19 13:21:50 +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
Charlie Vieth d14d62074e Add winrm functionality to vmware-iso builder (#3738)
* Use winrm_host, if provided, this allows packer to work in ESXi
environments without DHCP.

Signed-off-by: Charlie Vieth <cviethjr@pivotal.io>
2016-08-19 13:02:55 +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
Ricard Clau acededfc6e tests actually test the floppies 2016-07-27 21:59:21 +01: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