* I had to contextualise Communicator.Start and RemoteCmd.StartWithUi
NOTE: Communicator.Start starts a RemoteCmd but RemoteCmd.StartWithUi will run the cmd and wait for a return, so I renamed StartWithUi to RunWithUi so that the intent is clearer.
Ideally in the future RunWithUi will be named back to StartWithUi and the exit status or wait funcs of the command will allow to wait for a return. If you do so please read carrefully https://golang.org/pkg/os/exec/#Cmd.Stdout to avoid a deadlock
* cmd.ExitStatus to cmd.ExitStatus() is now blocking to avoid race conditions
* also had to simplify StartWithUi
* removed packer.Cache and references since packer.Cache is never used except in the download step. The download step now uses the new func packer.CachePath(targetPath) for this, the behavior is the same.
* removed download code from packer that was reimplemented into the go-getter library: progress bar, http download restart, checksuming from file, skip already downloaded files, symlinking, make a download cancellable by context.
* on windows if packer is running without symlinking rights and we are getting a local file, the file will be copied instead to avoid errors.
* added unit tests for step_download that are now CI tested on windows, mac & linux.
* files are now downloaded under cache dir `sha1(filename + "?checksum=" + checksum) + file_extension`
* since the output dir is based on the source url and the checksum, when the checksum fails, the file is auto deleted.
* a download file is protected and locked by a file lock,
* updated docs
* updated go modules and vendors
this regroups the calls of tmp func calls into one package.
the tmp pkg allows to store tmp files under a common directory for easier managment
Squashed commit of the following:
commit 74b674c01560c6b547e9cab5e8afb486f0fe7d6c
Merge: fc94b5714 66001525d
Author: Matthew Patton <mpatton@enquizit.com>
Date: Fri Nov 2 02:02:38 2018 -0400
Merge branch 'remove_TMPDIR_docs' of github.com:tb3088/packer into remove_TMPDIR_docs
commit fc94b571428447aaf2e5171967c95cdf9e5c73ff
Author: Matthew Patton <mpatton@enquizit.com>
Date: Fri Nov 2 01:42:38 2018 -0400
update tests to honor configured temporary directory
commit 5a562359f4937af506607dd96ed1c46426093f52
Author: Matthew Patton <mpatton@enquizit.com>
Date: Thu Nov 1 18:52:38 2018 -0400
sync straggler to refactor. implement tests at packer/configfile instead of buried in docker.
commit 9d5a4a0935bfd049e2f8f50ad73e4455b42c9410
Author: Matthew Patton <mpatton@enquizit.com>
Date: Thu Nov 1 15:39:46 2018 -0400
insert URL to GoLang API for os.TempDir()
commit fbae4c2e051898aecd8705e9d8a20353430ede23
Author: Matthew Patton <mpatton@enquizit.com>
Date: Thu Nov 1 07:41:29 2018 -0400
revise documentation to match code
commit 3590fae8bd0afa92a161a49ed794ee32e357d583
Author: Matthew Patton <mpatton@enquizit.com>
Date: Thu Nov 1 07:21:59 2018 -0400
refacter config_file. replace all hard-coded os.TempDir with wrapper
commit d5c5306a97b648ded06a8eb76ce728f07c9924f0
Author: Matthew Patton <mpatton@enquizit.com>
Date: Wed Oct 31 20:11:36 2018 -0400
close massive file overwrite hole with TempDir
commit 0a72297da86089fbd07e4f7d9472a92fa4d1c733
Author: Matthew Patton <mpatton@enquizit.com>
Date: Wed Oct 31 01:06:00 2018 -0400
adjust var declaration scope
commit 20f68228b6c372d984ea5b055cfc8bda9b110ac5
Author: Matthew Patton <mpatton@enquizit.com>
Date: Wed Oct 31 00:54:35 2018 -0400
use mktemp() equivalent to create temporary directory
commit c73ebe3d8321664a2685a0baa8e441dd895b0db4
Author: Matthew Patton <mpatton@enquizit.com>
Date: Tue Oct 30 20:40:58 2018 -0400
remove extraneous variable declaration, fix FOR loop
commit 63549b8bd745a0090b15ed0b0ebf644162db27db
Author: Matthew Patton <mpatton@enquizit.com>
Date: Tue Oct 30 19:30:44 2018 -0400
match styistic convension with rest of docs
commit 976101074942db36f10d3a686d6d29ddb7c01926
Author: Matthew Patton <mpatton@enquizit.com>
Date: Tue Oct 30 19:08:39 2018 -0400
revert dangling config file change
commit 95159afbc05eac96ed11c3183af5fb0abe2f2d5c
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date: Fri Dec 29 23:53:43 2017 -0500
replace invalid TMPDIR variable wth PACKER_TMP_DIR.
update ConfigTmpDir() to try common temporary paths first and
only write to configDir() as a last resort.
commit 66001525d72de56a4cf9339b900c46f59bc6e91a
Author: Matthew Patton <mpatton@enquizit.com>
Date: Fri Nov 2 01:42:38 2018 -0400
update tests to honor configured temporary directory
commit e9b6adefeae8c65eb8aa47fef38cbf0aa424338c
Author: Matthew Patton <mpatton@enquizit.com>
Date: Thu Nov 1 18:52:38 2018 -0400
sync straggler to refactor. implement tests at packer/configfile instead of buried in docker.
commit 852113ed076e2d14e5dca6815ea680da1e2896bb
Author: Matthew Patton <mpatton@enquizit.com>
Date: Thu Nov 1 15:39:46 2018 -0400
insert URL to GoLang API for os.TempDir()
commit 54add38d1d1c6e283cd444b367ed8bd49a5f3699
Author: Matthew Patton <mpatton@enquizit.com>
Date: Thu Nov 1 07:41:29 2018 -0400
revise documentation to match code
commit 6b5b8f6d4edad0e187ca13d64ac4118f34eee643
Author: Matthew Patton <mpatton@enquizit.com>
Date: Thu Nov 1 07:21:59 2018 -0400
refacter config_file. replace all hard-coded os.TempDir with wrapper
commit c22092c601c33484327674f322c7379fa41506d7
Author: Matthew Patton <mpatton@enquizit.com>
Date: Wed Oct 31 20:11:36 2018 -0400
close massive file overwrite hole with TempDir
commit 7a730450916bf8e5dbc2a741ec233a49466ab7cc
Author: Matthew Patton <mpatton@enquizit.com>
Date: Wed Oct 31 01:06:00 2018 -0400
adjust var declaration scope
commit 0f2933adb6f6922dfeab78a95371a444ec8918ab
Author: Matthew Patton <mpatton@enquizit.com>
Date: Wed Oct 31 00:54:35 2018 -0400
use mktemp() equivalent to create temporary directory
commit d74839ede05dacf712b55a7bb48aec19fe6b007f
Author: Matthew Patton <mpatton@enquizit.com>
Date: Tue Oct 30 20:40:58 2018 -0400
remove extraneous variable declaration, fix FOR loop
commit eb65416619437e4a3dec90277770803dd5b2281c
Author: Matthew Patton <mpatton@enquizit.com>
Date: Tue Oct 30 19:30:44 2018 -0400
match styistic convension with rest of docs
commit acaa2b31ed463219c4ef099f351eec72406e2989
Author: Matthew Patton <mpatton@enquizit.com>
Date: Tue Oct 30 19:08:39 2018 -0400
revert dangling config file change
commit e573fde668dcb418561e61535c1d68b2888f5b0f
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date: Fri Dec 29 23:53:43 2017 -0500
replace invalid TMPDIR variable wth PACKER_TMP_DIR.
update ConfigTmpDir() to try common temporary paths first and
only write to configDir() as a last resort.
commit 39a9874afc9dea71b36753375fb7feb61ffecf69
Merge: 8a413cfe8 3315812c2
Author: Matthew Patton <mpatton@enquizit.com>
Date: Tue Oct 30 18:19:26 2018 -0400
Merge branch 'master' of https://github.com/hashicorp/packer into prestine
commit 8a413cfe83b0a70dbd99c32d936334ca5788ca9b
Merge: e07491de5 4e14710a6
Author: Matthew Patton <mpatton@enquizit.com>
Date: Mon Oct 1 20:18:10 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit e07491de59cead0b337a7f57f4a6c625e1f560ab
Merge: 42610a35d a1fa35dff
Author: Matthew Patton <mpatton@enquizit.com>
Date: Tue Aug 21 13:26:19 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit 42610a35d5ef65af8844a58ad70e2ec75262da6a
Merge: 5298142da 0d63cf7bc
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date: Tue Jun 19 22:45:05 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit 5298142da6da95354844f201deeeef3c599e48b2
Merge: 7bb110bc7 9d9736552
Author: Matthew Patton <mpatton@enquizit.com>
Date: Mon Jun 11 15:10:09 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit 7bb110bc744c9797fcaec25a265d9b85a22d6d6b
Merge: a61c869ca 6189d66e7
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date: Wed May 9 23:41:22 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit a61c869ca7268acf0e3b1e1fa7a8ee7feea65984
Merge: 098101dd9 4be5f072c
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date: Fri May 4 10:13:04 2018 -0400
Merge remote-tracking branch 'upstream/master' into prestine
commit 098101dd99f08b0ca110d33eff6904537c6d21de
Merge: fefaf0fa6554b2b4a5
Author: Matthew Patton <matthew.patton@itgfirm.com>
Date: Tue May 1 20:52:30 2018 -0400
Merge branch 'EOL-handling' into prestine
Co-Authored-By: Matthew Patton <pattonme@yahoo.com>
Let's cache the scancodes and flush them at the end. Also make sure to
send only as many as the driver can send correctly. It's important here
to chunk the scancodes correctly, so that we don't accidentally split them
over successive calls to the driver
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, /' {} \;`
This changeset performs the following:
- Updates `masterzen/winrm` vendor to include change from (https://github.com/masterzen/winrm/pull/73).
- Removes `masterzen/xmlpath` dependency, as it is licensed under the LGPL license.
- Updates `dylanmei/winrmtest` vendor to include change from (https://github.com/dylanmei/winrmtest/pull/4).
- Updates `packer-community/winrmcp` vendor to include the removal of the `masterzen/winrm/winrm` sub-class as a result of the `winrm` CLI tool being removed from the `masterzen/winrm` repository.
- Updates nested dependencies as a result of the above vendor changes.
- Refactors `parallels/driver_9` to use `goxpath` instead of `xmlpath`, as `xmlpath` is licensed under LGPL.
- Adds a basic unit test for the refactor work in `parallels/driver_9` to confirm functionality.
This should completely remove any LGPL licensed dependencies inside of the Packer project.
```
$ make test
/home/jake/src/go/src/github.com/hashicorp/packer/scripts/gofmtcheck.sh $(find . -not -path "./vendor/*" -name "*.go")
==> Checking that code complies with gofmt requirements...
Check passed.
ok github.com/hashicorp/packer 0.044s
ok github.com/hashicorp/packer/builder/alicloud/ecs 0.055s
ok github.com/hashicorp/packer/builder/amazon/chroot 0.040s
ok github.com/hashicorp/packer/builder/amazon/common 0.021s
ok github.com/hashicorp/packer/builder/amazon/ebs 0.016s
ok github.com/hashicorp/packer/builder/amazon/ebssurrogate 0.015s
ok github.com/hashicorp/packer/builder/amazon/ebsvolume 0.014s
ok github.com/hashicorp/packer/builder/amazon/instance 0.058s
ok github.com/hashicorp/packer/builder/azure/arm 2.833s
ok github.com/hashicorp/packer/builder/azure/common 0.018s
? github.com/hashicorp/packer/builder/azure/common/constants [no test files]
? github.com/hashicorp/packer/builder/azure/common/lin [no test files]
? github.com/hashicorp/packer/builder/azure/common/logutil [no test files]
ok github.com/hashicorp/packer/builder/azure/common/template 0.038s
ok github.com/hashicorp/packer/builder/azure/pkcs12 0.120s
ok github.com/hashicorp/packer/builder/azure/pkcs12/rc2 0.020s
ok github.com/hashicorp/packer/builder/cloudstack 0.038s
ok github.com/hashicorp/packer/builder/digitalocean 0.015s
ok github.com/hashicorp/packer/builder/docker 0.028s
ok github.com/hashicorp/packer/builder/file 0.029s
ok github.com/hashicorp/packer/builder/googlecompute 3.162s
ok github.com/hashicorp/packer/builder/hyperv/common 0.006s
ok github.com/hashicorp/packer/builder/hyperv/iso 0.042s
ok github.com/hashicorp/packer/builder/null 0.018s
ok github.com/hashicorp/packer/builder/oneandone 0.022s
ok github.com/hashicorp/packer/builder/openstack 0.052s
ok github.com/hashicorp/packer/builder/parallels/common 2.549s
ok github.com/hashicorp/packer/builder/parallels/iso 0.050s
ok github.com/hashicorp/packer/builder/parallels/pvm 0.033s
ok github.com/hashicorp/packer/builder/profitbricks 0.023s
ok github.com/hashicorp/packer/builder/qemu 0.039s
ok github.com/hashicorp/packer/builder/triton 0.018s
ok github.com/hashicorp/packer/builder/virtualbox/common 5.533s
ok github.com/hashicorp/packer/builder/virtualbox/iso 0.044s
ok github.com/hashicorp/packer/builder/virtualbox/ovf 0.012s
ok github.com/hashicorp/packer/builder/vmware/common 5.325s
ok github.com/hashicorp/packer/builder/vmware/iso 0.076s
ok github.com/hashicorp/packer/builder/vmware/vmx 0.010s
ok github.com/hashicorp/packer/command 0.062s
ok github.com/hashicorp/packer/common 0.053s
ok github.com/hashicorp/packer/common/json 0.003s [no tests to run]
ok github.com/hashicorp/packer/common/powershell 0.015s
? github.com/hashicorp/packer/common/powershell/hyperv [no test files]
? github.com/hashicorp/packer/common/ssh [no test files]
ok github.com/hashicorp/packer/common/uuid 0.010s
ok github.com/hashicorp/packer/communicator/none 0.008s
ok github.com/hashicorp/packer/communicator/ssh 0.068s
ok github.com/hashicorp/packer/communicator/winrm 0.046s
ok github.com/hashicorp/packer/fix 0.005s
ok github.com/hashicorp/packer/helper/builder/testing 0.007s
ok github.com/hashicorp/packer/helper/communicator 0.013s
ok github.com/hashicorp/packer/helper/config 0.004s
? github.com/hashicorp/packer/helper/enumflag [no test files]
ok github.com/hashicorp/packer/helper/flag-kv 0.009s
ok github.com/hashicorp/packer/helper/flag-slice 0.006s
ok github.com/hashicorp/packer/packer 0.219s
ok github.com/hashicorp/packer/packer/plugin 0.233s
ok github.com/hashicorp/packer/packer/rpc 0.141s
ok github.com/hashicorp/packer/plugin/example 0.008s [no tests to run]
? github.com/hashicorp/packer/post-processor/alicloud-import [no test files]
? github.com/hashicorp/packer/post-processor/amazon-import [no test files]
ok github.com/hashicorp/packer/post-processor/artifice 0.003s [no tests to run]
ok github.com/hashicorp/packer/post-processor/atlas 0.018s
ok github.com/hashicorp/packer/post-processor/checksum 0.015s
ok github.com/hashicorp/packer/post-processor/compress 0.047s
ok github.com/hashicorp/packer/post-processor/docker-import 0.012s
ok github.com/hashicorp/packer/post-processor/docker-push 0.012s
ok github.com/hashicorp/packer/post-processor/docker-save 0.008s
ok github.com/hashicorp/packer/post-processor/docker-tag 0.008s
ok github.com/hashicorp/packer/post-processor/googlecompute-export 0.015s [no tests to run]
? github.com/hashicorp/packer/post-processor/manifest [no test files]
ok github.com/hashicorp/packer/post-processor/shell-local 0.028s
ok github.com/hashicorp/packer/post-processor/vagrant 0.030s
ok github.com/hashicorp/packer/post-processor/vagrant-cloud 0.028s
ok github.com/hashicorp/packer/post-processor/vsphere 0.014s
ok github.com/hashicorp/packer/provisioner 0.011s
ok github.com/hashicorp/packer/provisioner/ansible 0.140s
ok github.com/hashicorp/packer/provisioner/ansible-local 0.056s
ok github.com/hashicorp/packer/provisioner/chef-client 0.050s
ok github.com/hashicorp/packer/provisioner/chef-solo 0.061s
ok github.com/hashicorp/packer/provisioner/converge 0.018s
ok github.com/hashicorp/packer/provisioner/file 0.015s
ok github.com/hashicorp/packer/provisioner/powershell 0.168s
ok github.com/hashicorp/packer/provisioner/puppet-masterless 0.008s
ok github.com/hashicorp/packer/provisioner/puppet-server 0.031s
ok github.com/hashicorp/packer/provisioner/salt-masterless 0.010s
ok github.com/hashicorp/packer/provisioner/shell 0.010s
ok github.com/hashicorp/packer/provisioner/shell-local 0.037s
ok github.com/hashicorp/packer/provisioner/windows-restart 0.180s
ok github.com/hashicorp/packer/provisioner/windows-shell 0.159s
? github.com/hashicorp/packer/scripts [no test files]
ok github.com/hashicorp/packer/template 0.008s
ok github.com/hashicorp/packer/template/interpolate 0.004s
? github.com/hashicorp/packer/version [no test 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
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.
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.
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.
If the Parallels Desktop for Mac version is higher than the latest
Packer driver use the latest available driver. Before this Packer needed
to be updated with every new version of PD even if there was no change
to the driver.
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 template.
The ISO builders (parallels, qemu, virtualbox, and vmware) had too
much common code which needed to be maintained separately. This change
moves that code to a common ISO configuration.