Commit Graph

455 Commits

Author SHA1 Message Date
Adrien Delorme 4bf6a56d71 split communitacor.SSH & communitacor.WinRM to facilitate documentation
put doc for communicator into the struct
2019-06-06 16:55:24 +02:00
Adrien Delorme 4399684372 make fmt autogenerated docs 2019-06-06 16:29:25 +02:00
Adrien Delorme e6cbb013ba add // go:generate struct-markdown to all previously edited files 2019-06-05 16:42:18 +02:00
Adrien Delorme f1917edd34 generate the comments for config struct of builders scraping doc website 2019-06-05 16:42:17 +02:00
Adrien Delorme d72040f4fa move retry code into the common/retry pkg and make retry context aware 2019-04-09 17:46:38 +02:00
Adrien Delorme f555e7a9f2 allow a provisioner to timeout
* 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
2019-04-08 20:09:21 +02:00
Adrien Delorme c4f3dccc14 rename interpolation context from ctx to ictx and contexts to ctx to avoid conflicts 2019-04-03 15:56:15 +02:00
Adrien Delorme a4bf94dd3c change Builder to be passed a context for cancellation
we have to to give it to our hook
2019-04-03 15:55:55 +02:00
Megan Marsh 9f1a4e0fed
Merge pull request #7423 from hashicorp/lock_ports
Lock packer ports using a lock file
2019-03-26 10:35:18 -06:00
Adrien Delorme 5a6dffde9a use port as ints 2019-03-19 15:01:12 +01:00
Adrien Delorme c214f6735b make everything a uint 2019-03-19 12:54:15 +01:00
Adrien Delorme f67b5ff59d virtualbox StepConfigureVRDP: use common/net pkg to find open port 2019-03-19 12:54:15 +01:00
Adrien Delorme 59370986fb virtualbox StepForwardSSH: use common/net pkg to find open port 2019-03-19 12:54:15 +01:00
Vadym Haidamaka 414d0750f0 Add tests to validate 'none' communicator in the virtualbox builder 2019-03-16 18:18:29 +02:00
Vadym Haidamaka 0263503c45 Validate virtualbox_version_file and guest_additions_mode when communicator is none 2019-03-16 18:15:27 +02:00
Adrien Delorme 9f82b75e57 Use the hashicorp/go-getter to download files
* 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
2019-03-13 12:11:58 +01:00
Megan Marsh 3dc1dafe58
Merge pull request #7287 from stephen-fox/ephemeral-ssh-key-pair-issue-7225
virtualbox: create ephemeral SSH key pair for build process
2019-03-04 14:25:04 -08:00
Stephen Fox 7e1cbc6d89 Rename references to key pair name to comment.
Per the OpenSSH manual, the field is for a comment.
2019-03-01 10:00:29 -05:00
Stephen Fox 61a8968b22 Use 'os.OpenFile' to atomically create debug key file.
Per code review feedback.
2019-02-28 17:23:33 -05:00
Stephen Fox 094c87e395 Remove 'SSHPublicKeyUrlEncoded', use 'urlquery' instead.
Per code review feedback, the Go template library supports
encoding variables in URL query format. Instead of exposing
two different public key formats (unmodified string and a
URL encoded string), just have the user apply the 'urlquery'
modifier to their template.
2019-02-28 17:06:51 -05:00
Stephen Fox 2ef6b9247d Initial take on code review feedback from @azr.
Do not use builder pattern or interfaces; stick to structs and
some basic functions.
2019-02-25 17:16:24 -05:00
Megan Marsh 3fd589fa72 typos 2019-02-08 09:31:30 -08:00
Megan Marsh e2d8c0bfd7 docs 2019-02-08 09:28:10 -08:00
Megan Marsh 07c0c599e0 attach guest additions via SATA when necessasry 2019-02-08 09:15:15 -08:00
chris marget 53c0376dfd don't print keypair to the user's screen 2019-02-06 13:54:05 -05:00
chris marget 13cc73d600 keypair parsing and testing 2019-02-06 13:46:55 -05:00
Stephen Fox f9d24ccda0 Allow user to get public key straight up, or URL encoded. 2019-02-05 11:59:13 -05:00
Stephen Fox f2c11b55be Renamed authorized_keys public key function. 2019-02-04 14:27:14 -05:00
Stephen Fox 01c98f3d82 Tweaked debug SSH private key file name for vbox. 2019-02-04 12:47:18 -05:00
Stephen Fox c6ae8654d9 Moved SSH key pair code into 'helper/ssh'. 2019-02-04 12:21:58 -05:00
Stephen Fox 25775886a8 Properly set SSH key pair name. 2019-02-04 12:12:18 -05:00
Stephen Fox be081944b1 Moved new key pair funcs closer to builder funcs. 2019-02-04 12:09:23 -05:00
Stephen Fox b1b67ecffa Added support for setting a name in SSH key pair.
Also refactored how new SSH key pairs are created, and how the
tests are structured.
2019-02-04 12:07:32 -05:00
Stephen Fox 5893134c61 Updated comment for 'PrivateKeyPemBlock()'. 2019-02-04 10:02:07 -05:00
Stephen Fox cd4ae03324 Create / use SSH key pairs in vbox builders.
This follows the business logic for creating / using SSH key pairs
in the cloud-type builders (e.g., Amazon EC2).
2019-02-03 12:20:52 -05:00
Stephen Fox 72d1501551 Made SSH public key available in vbox boot command.
The SSH public key (in authorized_keys format) can be retreived in
the build template by specifying '{{ .SSHPublicKey }}'. The key is
URL encoded to escape spaces.
2019-02-03 12:20:42 -05:00
Stephen Fox 459bd1ea7a Added vbox step for SSH key pair business logic. 2019-02-03 12:07:57 -05:00
Stephen Fox 6824806e6f Allow caller to specify new line for SSH public key.
The default behavior of the various builders that create SSH key
pairs appears to be to add a trailing new line. This will be the
default behavior, but at least it can be customized if desired.
2019-02-03 10:37:32 -05:00
Stephen Fox ad075ffac3 Added 'Description()' to 'sshKeyPair'.
Also cleaned up tests.
2019-02-03 09:17:18 -05:00
Stephen Fox f233e54992 Initial SSH key pair helper implementation. 2019-01-30 22:10:27 -05:00
Megan Marsh 97a791389a deduplicate step_output_dir and move to common folder 2019-01-11 15:06:36 -08:00
Adrien Delorme c8a39e939a
Merge pull request #7178 from edwardmlyte/simplify-version-check
Simplify version check for port count argument
2019-01-10 16:07:00 +01:00
Ed Maxwell-Lyte e8e92fe6c6 rename clashing import 2019-01-09 16:30:54 +00:00
Ed Maxwell-Lyte 4437f8d8ba Use go-version for comparison 2019-01-09 16:22:33 +00:00
Ed Maxwell-Lyte 346f5d9bba Simplify version check for port count argument
Might be personal preference, but I think this reads more clearly
2019-01-09 09:46:24 +00:00
Adrien Delorme 9f7b4ffc17
Merge branch 'master' into pr/6950 2019-01-09 10:11:18 +01:00
Ed Maxwell-Lyte 4fc02ea406 Assign to existing var 2019-01-08 16:19:11 +00:00
Adrien Delorme f91b668617
Create portCountArg in the if statement
You can't assign to something that doesn't exist

Co-Authored-By: edwardmlyte <edwardmlyte@gmail.com>
2019-01-08 16:15:24 +00:00
Ed Maxwell-Lyte a9eed311a6 Run gofmt on driver_4_2.go 2019-01-08 15:58:12 +00:00
Ed Maxwell-Lyte e5b1e0f4d9 Add version 0.x to the rule 2019-01-08 15:35:45 +00:00