Commit Graph

654 Commits

Author SHA1 Message Date
Ladar Levison 348c267054 Updated support for legacy network adapters on Hyper-V. 2018-12-18 04:59:00 -06:00
Megan Marsh b95123f457 add new copy_in_compare flag so users can set the copy var to whatever they need in order to get the compatibility report to work. 2018-12-13 09:12:23 -08:00
Adrien Delorme b7222d1f56 Add tmp package that offers Dir & File funcs
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: fefaf0fa6 554b2b4a5
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>
2018-12-12 16:35:57 +01:00
Anish Bhatt d5f88b154f
Better fix for #7095 2018-12-11 10:34:07 -08:00
Anish Bhatt 916375183b
Don't run StepCleanupTempKeys when communicator is set to none 2018-12-10 15:33:19 -08:00
Megan Marsh e69391f28b save users some bash scripting by exposing IP and port separately as well as together 2018-12-06 09:29:07 -08:00
pgrmega 2d1e3efadb
Fix a problem when calling Hyper-V\Compare-VM PowerShell cmdlet (#6726) 2018-11-20 22:10:03 +01:00
Megan Marsh f9ceaee4f1 fix variable casing convention 2018-10-22 14:34:50 -07:00
Joel Vasallo 5d17b3de84 fix: config validator output 2018-10-19 19:52:11 -05:00
Joel Vasallo 23ad90f2c4 fix: condensed and simplified os check logic and added validate output 2018-10-19 13:48:30 -05:00
Joel Vasallo d408c9e69c fix: moved os check to entry of func 2018-10-19 01:38:51 -05:00
Joel Vasallo 0912adea34 fix: converted onlyon param to only_on and added validation step 2018-10-19 00:51:25 -05:00
Joel Vasallo 25c0b98363 feat: ability to specify runtime OSs where shell-local should run 2018-10-18 15:10:04 -05:00
Adrien Delorme 02ba6ccfab make common/iso_config_test.go invisible to windows 2018-10-16 18:41:27 +02:00
Megan Marsh 847a3b0061 provide useful powershell error 2018-10-09 12:13:07 -07:00
Megan Marsh 3f8407d95f Revert "Merge pull request #6700 from hashicorp/multi_progressbar"
This reverts commit 5470c08345, reversing
changes made to c427486bca.
2018-09-20 13:14:17 -07:00
Megan Marsh 5470c08345
Merge pull request #6700 from hashicorp/multi_progressbar
Split progressbars per object
2018-09-19 15:22:14 -07:00
Megan Marsh 38cc525ec7 new option allowing user to clean up the ephemeral ssh key from the authorized_keys file 2018-09-14 11:06:38 -07:00
Adrien Delorme dfeca9f0df split progressbars per object 2018-09-12 16:21:58 -07:00
Megan Marsh a0edaf6c46 Going to revert this change for now, becuase of potential issues that arise from calling Prepare() twice
Revert "use statebag instead of SetSharedState for winRM password"

This reverts commit b35acbd879.
2018-09-10 16:48:42 -07:00
Adrien Delorme 32cacad273 remove comment that is not true anymore 2018-09-06 16:50:47 +02:00
Adrien Delorme bb59a70e8f progressbar: use int64 instead of uint64
* it's what's used for file sizes and used lib
2018-09-06 16:49:15 +02:00
Adrien Delorme f9c58e2b1f download: defer progress bar Finish 2018-09-06 16:38:28 +02:00
Adrien Delorme 3842f85eb4 download: remove close calls that are already defered 2018-09-06 16:30:35 +02:00
Adrien Delorme 23762a1810 fix tests for common/download_test.go 2018-09-06 15:53:59 +02:00
Adrien Delorme 7f50228080 remove old/unused progress code 2018-09-06 15:53:59 +02:00
Adrien Delorme 059e14fe42 put back usefull debug 2018-09-06 15:53:59 +02:00
Adrien Delorme a11f985e3c revert unecessary check 2018-09-06 15:53:59 +02:00
Adrien Delorme a9d302def8 removed debug logs 2018-09-06 15:53:59 +02:00
Adrien Delorme 541c68aed5 add StackableProgressBar struct that will refresh/show dl status for multiple files
* simplified the downloader interface, and removed the total/current values from them
* downloaders use a proxy reader that will add all read bytes to progress
* removed unused const mtu
* DownloadClient doesn't need a downloader, so I removed it too
2018-09-06 15:53:59 +02:00
Adrien Delorme fd7cb47adc use proxy reader for download progress & stop storing total/current in downloaders 2018-09-06 15:53:59 +02:00
Adrien Delorme ddd96c513b first draft at self refreshing loading bar centralized/controlled by Ui 2018-09-06 15:53:59 +02:00
Adrien Delorme 5a8af5500b random: optimize allocation & simplify loop 2018-09-05 10:27:02 +02:00
Adrien Delorme 4682b3a9d2 refactor possible random strings into common/random 2018-09-05 10:26:52 +02:00
Adrien Delorme 170b2f3383 builder/azure/common.RandomString-> common/random.String
* to share them
* also removed unused PassworString func & arm.TempPasswordAlphabet package const
2018-09-05 10:24:28 +02:00
Adrien Delorme 9cefd69f0d
change progress bar display rate to 5s to reduce 'spamminess' (#6640)
#6625
2018-08-30 16:00:30 +02:00
Megan Marsh 8309f36176
Merge pull request #6626 from hashicorp/fix_6620
make reasonable tempfile default on windows
2018-08-27 09:43:04 -07:00
Matthew Hooker 7519037562
Merge pull request #6629 from hashicorp/travisbuild
travis builds go 1.11. remove 1.9
2018-08-24 20:51:31 -07:00
Matthew Hooker 8a604114ef
remove unused code 2018-08-24 20:43:51 -07:00
Matthew Hooker 3f1a9766f4
formatting verb fixes for go 1.11 2018-08-24 16:18:21 -07:00
Megan Marsh c5b346b07b
Merge pull request #6393 from DanHam/fix-hyperv-export
Various improvements to Hyper-V ISO and VMCX builders
2018-08-24 15:52:49 -07:00
Megan Marsh b35acbd879 use statebag instead of SetSharedState for winRM password 2018-08-24 13:51:16 -07:00
Megan Marsh f5355a0693 make reasonable tempfile default on windows 2018-08-24 09:44:50 -07:00
Megan Marsh 340363a649
Merge pull request #6613 from hashicorp/merge_ssh_config_funcs
Merge ssh config funcs from builders
2018-08-23 16:03:36 -07:00
Megan Marsh 1f79b430ee
Merge pull request #6610 from hashicorp/filter_logs
Filter logs
2018-08-23 13:30:21 -07:00
Megan Marsh 31d4f8af45 use a time.Duration instead of a hardcoded ms 2018-08-23 13:16:01 -07:00
Megan Marsh 918db58604 added new template variables to replace PACKER_KEY_INTERVAL with tunable key and keygroup intervals depending on driver used 2018-08-22 11:37:56 -07:00
Adrien Delorme 41f6e0334d refactor all copy pasted sshConfig with into communicator.Config.SSHConfigFunc
* still need to append the auth methods into an array for gracefullness
2018-08-22 17:02:23 +02:00
Ali Rizvi-Santiago cf9bbe3ecf Incorporated the hack demonstrated by @SwampDragons in order to deal with packer.rpc.Ui not exporting any information about what it's doing to anybody. 2018-08-20 21:55:18 -05:00
Ali Rizvi-Santiago 5726927cba Moved the progress bar out of packer.Ui and unlinked it out of all the packer.Ui implementations. Split up the terminal-related functions into a separate terminal.go and calculate the progress bar width by traversing through packer.Ui to avoid the issue with github.com/ugorji/go/codec serializing private members (or unsafe pointers) of structs. Shuffled some arguments around in getConsoleScreenBufferInfo in common/terminal_windows.go so that the interface forces the user to correctly declare a _CONSOLE_SCREEN_BUFFER_INFO type. 2018-08-20 21:55:18 -05:00
Ali Rizvi-Santiago 0f10032b3d Moved the progress bar from common to the packer.UI interface and refactored it so that the terminal width is calculated based on each interface which returns a custom progressbar specific to its ui. 2018-08-20 21:55:18 -05:00
Ali Rizvi-Santiago fd2fef8738 Added support for the progress bar to automatically determine its width using the minimum length from a packer.UI and the terminal dimensions via kernel32.GetConsoleScreenBufferInfo or an ioctl (TIOCGWINSZ) to "/dev/tty". 2018-08-20 21:55:18 -05:00
Ali Rizvi-Santiago 16ecb3ad9a Reverted removal of progress-bar that was done by commit 5d97b105a8 and added some missing arguments that were missed during the rebase. Modified the default progress bar's width to 80 as a result of the conversation on PR #5851. 2018-08-20 21:55:18 -05:00
Megan Marsh ff6a039d5b replace scrubconfig with packer.LogSecretFilter.Set
filter winrm password from logs
Add new root-level packer template option, sensitive-variables, to tell us what user variables to mark sensitive.
2018-08-20 15:35:55 -07:00
Adrien Delorme a5587e30ec log wether the file was transfered or is just being inplace referenced 2018-08-20 11:45:57 +02:00
Adrien Delorme 6b3844a64f
Revert "allow to use ISO images in-place v.s. copying them" 2018-08-20 10:48:06 +02:00
Adrien Delorme c744e8b2bb make download messages less redudant and more simple 2018-08-17 09:29:39 +02:00
Adrien Delorme d7d4aed51c be even more precise 2018-08-16 18:56:28 +02:00
Adrien Delorme 2b3ea29970 show more precise error download/copy/referencing messages 2018-08-16 18:41:44 +02:00
Adrien Delorme fae3db4e58 test inplace linking 2018-08-15 17:09:39 +02:00
Adrien Delorme 17f2949e36 remove stuttering; ISOConfig.InplaceISO -> Inplace 2018-08-15 15:51:25 +02:00
Adrien Delorme 863222b1e2 Also use the terminology Inplace in DownloadConfig for clarity/consistency
* swapped boolean checks
* swapped in tests too
2018-08-15 15:26:31 +02:00
Adrien Delorme 82e480a285 allow to use ISO images inplace v.s. copying them 2018-08-15 14:37:38 +02:00
Ali Rizvi-Santiago 71e43d0b7f Updated common/download.go to handle when a connection error happens (response is nil), and reformatted the error that's returned when an HTTP error occurs. 2018-07-28 19:09:29 -05:00
Megan Marsh 5ef8b55559 need log import 2018-07-23 10:34:05 -07:00
Megan Marsh a2f5fbadf6 don't fail if you can't find abs or relative path. 2018-07-23 09:54:25 -07:00
DanHam da21c25791
Convert incorrect 'vmxc' -> 'vmcx' in codebase, docs and template opts
grep -rli --exclude-dir={vendor,bin\*,\*vmware\*,\*pkg\*} vmxc . | \
xargs sed -i 's/\(vm\)\(x\)\(c\)/\1\3\2/ig'
2018-07-20 02:12:47 +01:00
DanHam 674bad0ab4
Break very long lines for readability 2018-07-20 02:12:47 +01:00
DanHam d2390f464d
Actually implement the function for the driver 2018-07-20 02:12:45 +01:00
DanHam c2437ba592
Remove the option to place the VHD files in a separate directory
The export process now exports the VM directly from the build directory
into the output directory. There are no intermediate steps or copying of
files involved. This means that there is no longer any benefit in having
a separate directory to house the VHD files - see #5206 for the
reasoning behind the introduction of this feature.

If a user wishes to house the build files on a separate disk from the
output directory (perhaps for performance reasons or due to disk space
limitations) they can still do so through the use of `temp_path`.
2018-07-20 02:12:43 +01:00
DanHam c6b9d9ce90
Add checks/error reporting to compaction process
* Report compaction results
* Failure to find any disks under the supplied path is treated as a
  'soft' error and a warning message will be printed in place of the
  compaction result. Any other failure will cause the build to fail.
2018-07-20 02:12:42 +01:00
DanHam 534fc4a473
Ensure the export directory structure matches that of previous versions
Commit 3fc2defb6 altered the directory structure associated with an
exported VM. The changes mean that the export process now stores the
exported machine files and folders under a folder with name 'vm_name' in
the output directory.
This commit restores the previous behaviour whereby the exported machine
files and folders were stored directly in the output directory. This
allows us to keep the efficiency improvements introduced with 3fc2defb6
while maintaining backward compatibility.

By default the Export-VM command creates three folders in the specified
export directory - 'Virtual Hard Disks', 'Virtual Machines' and
'Snapshots'. When a machine with no associated snapshots is exported the
'Snapshots' directory is empty.
Prior to 3fc2defb6 the Snapshots folder was not copied/incorporated into
the output directory at all. This was a bug.
This commit preserves the legacy behaviour by not including an empty
Snapshots directory in the export. However, if there *are* Snapshots
associated with the VM, they are now moved into the output directory
along with the usual directories containing disks and VM metadata. This
prevents warnings/errors on import due to missing snapshots.
2018-07-20 02:09:57 +01:00
DanHam dc46848f89
Remove now redundant function to copy exported VM files 2018-07-20 02:09:57 +01:00
DanHam 3fc2defb6d
Refactor the export step for Hyper-V ISO and VMCX builders
* Fixes a bug that caused the build to error if users did not
  explicitly set `skip_compaction:true` when setting `skip_export:
  true`. See #6392.
* Improves the efficiency of the compaction and export process by
  reordering the compaction and export steps.
* Further improves the efficiency of the compacting step through
  compacting the vmd* file directly rather than creating and then
  operating on a copy.
* The changes mean the export process now stores the exported machine
  files and folders under a folder with name 'vm_name' in the output
  directory. Previously the exported machine files and folders were
  stored directly in the output directory.
2018-07-20 02:09:54 +01:00
Mathieu Tarral edcc0b3853 shell-local: expose PACKER_HTTP_ADDR env var 2018-07-17 18:49:36 +03:00
Megan Marsh 0df33cd032 fix relative pathing versus iso checksum dir to work even if user has provided a relative path for the iso_url which is relative to the directory where Packer is run. 2018-07-13 09:21:04 -07:00
Megan Marsh d0f0da6626 allow absolute paths to isos in checksum files 2018-07-13 09:14:59 -07:00
M. Marsh e5a63a674e
Merge pull request #6422 from DanHam/fix-gh-vmsecureboot
Hyper-V: Use Get-Command over Get-Help to check for SecureBootTemplate parameter
2018-06-25 16:48:16 -07:00
M. Marsh baaca808e8
Merge pull request #6412 from hashicorp/fix_config_validation_bug_windows_shell_local
found a config validation bug where packer crashes instead of throwin…
2018-06-25 16:47:23 -07:00
DanHam 297f6b85ec
Use Get-Command over Get-Help to check for SecureBootTemplate parameter 2018-06-25 23:52:01 +01:00
Simon Hulme 475e79a251 Fixed SecureBootTemplate not being passed through to PS cmdlet
Added check for SecureBootTemplate parameter for Server 2012 and below
Corrected enableSecureBootString usage
2018-06-25 14:13:43 +01:00
Megan Marsh 4a7953f93a found a config validation bug where packer crashes instead of throwing a validation error if a windows-style path is provided to a provisioner on linux 2018-06-22 13:49:39 -07:00
Jordan Borean efa9021974
Check if hyper-v addresses is an array before slicing it 2018-06-18 14:45:33 +10:00
Giovanni Tirloni 28095cf027 Do not return error on initial HEAD request 2018-06-13 20:30:19 -03:00
Giovanni Tirloni b7ea0b44fc HTTPDownloader - Fix invalid error handling 2018-06-13 17:42:27 -03:00
M. Marsh a012f70e71
Merge pull request #6251 from hashicorp/do_winrm_shell_local
access automatically generated winrm password from shell-local
2018-05-29 12:09:40 -07:00
Megan Marsh 3afca6905b remove duplicate assignmnet 2018-05-29 11:47:27 -07:00
Matthew Hooker 6a769f08d8
regenerate boot command code 2018-05-29 11:17:51 -07:00
Matthew Hooker 788418cff2
Add unit test to show that we handle tars safely 2018-05-25 12:13:59 -07:00
Megan Marsh 846f94c964 implement template variable for accessing WinRM password in either environemnt variables or directly in execute_command or inline commands. 2018-05-23 16:00:43 -07:00
M. Marsh 62e1323577
Merge pull request #5956 from hashicorp/dedupe_shell_local
Deduplicate the code for the shell-local post-processor and shell-local provisioner
2018-05-23 15:54:27 -07:00
Megan Marsh d1e31c0f23 use if/else to clarify code 2018-05-21 15:19:27 -07:00
Megan Marsh 969201a2d4 handle minor shell-local PR suggestions and corrections 2018-05-21 14:56:44 -07:00
Megan Marsh 1fdf763d0f fancier logging 2018-05-21 11:25:51 -07:00
M. Marsh edb5c1f50d
Merge pull request #6243 from camjjack/hyper-v-gui
Using vmconnect to display gui for hyper-v
2018-05-18 11:24:24 -07:00
WaaZaa666 b747877222
Fixing #6267, multiple hyper-v disks 2018-05-17 14:50:18 +02:00
Unknown 29c4b4436d Changes requested in PR #6243
- Logging error if vmconnect.exe fails.
- Using StepRun struct rather than StateBag for command Cancel function
- Better handling in Disconnect when headless is true or vmconnect failed in Start
2018-05-14 20:52:10 +10:00
Unknown fc734b6bd9 Using vmconnect to display gui for hyper-v
vmconnect.exe comes as part of Hyper-V and is the tool used by Hyper-V Manager to connect with a virtual machine. This commits sets behaviour the same as virtualbox and vmware to display the virtual machine connection unless headless is set in the template.
2018-05-14 20:52:10 +10:00
M. Marsh 5871b8242b
Merge pull request #6101 from adarobin/azurecompatible
Add use_fixed_vhd_format Hyper-V ISO option
2018-05-10 17:02:44 -07:00
Stefan Henseler 6f00596053 Adds config option to specify hyper-v secure boot template 2018-05-10 19:00:35 +02:00
DanHam d9d8b93c14
Remove tmp file created by common/ test. Avoid possible race condition. 2018-05-09 22:09:05 +01:00
M. Marsh 7c46e3d89c
Merge pull request #6207 from gtirloni/issue-6203
[WIP] Handle HTTP download errors
2018-05-08 15:56:06 -07:00
Matthew Hooker 5e6e12cacd
Use fmt to convert whatever's in error to a string.
This way we don't crash if someone sticks something else in the error
key in the state bag (which a quick glance at the code tells me we're
already doing.

Perhaps in the future we can add an error attribute to the state bag
but for now this will have to suffice.
2018-05-08 15:22:02 -07:00
Matthew Hooker 0a1842140b
Display build error when on-error=ask|abort 2018-05-08 04:06:03 -07:00
Megan Marsh 1bea658e16 fix command and inline calls on windows 2018-05-07 15:10:10 -07:00
Megan Marsh fabd1a6517 windows cmd env vars 2018-05-07 15:10:10 -07:00
Megan Marsh 9651432378 preserver BC for people using 'command' option 2018-05-07 15:10:10 -07:00
Megan Marsh dd183f22d9 update docs and add warnings around WSL limitations 2018-05-07 15:10:10 -07:00
Megan Marsh 51bcc7aa13 add new feature for telling shell-local whether to use linux pathing on windows; update docs with some examples. 2018-05-07 15:10:10 -07:00
Megan Marsh e983a94a88 fix default windows bash call for shell-local provisioner and move chmod command from the execute_command array into the portion of code where we actually generate inline scripts, sparing users the need to think about this modification which Packer should really handle on its own
make bash call work on windows
2018-05-07 15:10:10 -07:00
Megan Marsh 5da4377f21 first pass at docs update 2018-05-07 15:10:10 -07:00
Megan Marsh 854d6fb141 add tests making sure post-processor has backwards compatability 2018-05-07 15:10:10 -07:00
Megan Marsh f799003b66 tighten up shell-local config validation 2018-05-07 15:10:10 -07:00
Megan Marsh 479d36734d consolidate shell-local defaulting of InlineShebang and ExecuteCommand to the config validation 2018-05-07 15:10:10 -07:00
Megan Marsh d304234725 fix tests 2018-05-07 15:10:10 -07:00
Megan Marsh 67739270bb pull temp file writing into its own function for easier testing 2018-05-07 15:10:10 -07:00
Megan Marsh 6dc4b1cbdc move all of the run commands for shell-local provisioner and postprocessor into common library too 2018-05-07 15:10:09 -07:00
Megan Marsh c7c66bedcb set inline to an empty array, rather than nil 2018-05-07 15:10:09 -07:00
Megan Marsh 926327beba deduplicate all validation and interpolation of the shell-local config, sharing options between shell-local provisioner and post-processor. Maintain backwards compatibility with shell-local provisioner. 2018-05-07 15:10:09 -07:00
Megan Marsh 616b41e58f deduplicate the nearly identical communicators for the shell-local provisioner and post-processor, moving single communicator into a new common/shell-local module 2018-05-07 15:10:09 -07:00
M. Marsh bf6dc932d5
Merge pull request #6219 from jborean93/hyper-v-ip
Hyper-V: Add support retrieving IP for Server 2008 R2
2018-05-04 12:56:17 -07:00
DanHam 7e478f650e
Remove tmp files created by common/ tests 2018-04-30 18:16:46 +01:00
Jordan Borean 14e41fad7e
Hyper-V: Add support retrieving IP for Server 2008 2018-04-30 15:18:28 +10:00
Giovanni Tirloni 413d13c411
Handle HTTP download errors 2018-04-26 18:59:30 -03:00
Adam Robinson 3aebd5f462 Add use_fixed_vhd_format Hyper-V ISO option 2018-04-26 13:35:19 -04:00
Matthew Hooker a3bf2c786a
Use expression sequence generator in tests. 2018-04-23 16:32:18 -07:00
M. Marsh 69c7e2d51d
Merge pull request #6144 from hashicorp/winrm_password_fix
use build name to ensure that winrm password and other shared state i…
2018-04-23 09:12:52 -07:00
Matthew Hooker e4bd30e53d
fix bug with empty boot command. 2018-04-21 11:40:47 -07:00
Matthew Hooker b5a97e468f
fix test 2018-04-19 17:07:58 -07:00
Matthew Hooker 7e9af8247a
fix 2 byte scancodes for pc-xt VMs. 2018-04-19 17:02:39 -07:00
Matthew Hooker 675eae1e92
flush scancodes when we wait 2018-04-19 16:44:50 -07:00
Matthew Hooker 374d8f089f
better log message 2018-04-19 16:09:38 -07:00
Matthew Hooker 31d04f1945
remove outdated comment 2018-04-19 14:26:31 -07:00
Matthew Hooker df6224d04e
fix vnc config 2018-04-19 14:26:31 -07:00
Matthew Hooker aa69bdf74e
Perform validation of boot command. 2018-04-19 14:26:31 -07:00
Matthew Hooker 7d43324359
add menu key.
Replaces #5989
2018-04-19 14:26:31 -07:00
Matthew Hooker e9e27941cc
sort keycode lists 2018-04-19 14:26:31 -07:00
Matthew Hooker c6299972b9
s/boot_command/bootcommand/ 2018-04-19 14:26:31 -07:00
Matthew Hooker 7990966a09
fix boot command config struct name 2018-04-19 14:26:31 -07:00
Matthew Hooker 408eba88ad
flatten boot command config and implement for vmware 2018-04-19 14:26:30 -07:00
Matthew Hooker 9a8acbbcab
negative wait WIP 2018-04-19 14:26:30 -07:00
Matthew Hooker add7e8acb9
Stop sending boot commands when context canceled. 2018-04-19 14:26:30 -07:00
Matthew Hooker 94129b7fe3
we're using PC-XT (set1) not PC-AT 2018-04-19 14:26:30 -07:00
Matthew Hooker a46a7afa20
Remove old tests. 2018-04-19 14:26:29 -07:00
Matthew Hooker e2e7bc65fd
Make special keys case insensitive.
add tests
2018-04-19 14:26:29 -07:00
Matthew Hooker cba4d3235f
cleanup 2018-04-19 14:26:29 -07:00
Matthew Hooker bdb1eee7d8
Implement new parser for HyperV boot command 2018-04-19 14:26:29 -07:00
Matthew Hooker f9ad264f4d
Comments 2018-04-19 14:26:29 -07:00
Matthew Hooker 81d127768c
Add key press interval to virtualbox. 2018-04-19 14:26:29 -07:00
Matthew Hooker 59376294ef
Maximize scancode throughput.
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
2018-04-19 14:26:29 -07:00
Matthew Hooker 9b7704c714
Implement new parser for Parallels boot command 2018-04-19 14:26:29 -07:00
Matthew Hooker 99d61920d0
Abstract vbox driver into PC-AT driver. 2018-04-19 14:26:29 -07:00
Matthew Hooker e4af71858f
Implement new parser for Virtualbox boot command
Remove boot wait for virtualbox run step
2018-04-19 14:26:29 -07:00
Matthew Hooker 1c0af28662
Some cleanup and comments. 2018-04-19 14:26:29 -07:00
Matthew Hooker 673245afcf
Replace boot command parser with PEG parser. 2018-04-19 14:26:28 -07:00
M. Marsh f5c031baf9
Merge pull request #5941 from synax/hyper-v-disk-block-size
Adds Support to configure hyper-v disk block size
2018-04-19 11:27:52 -07:00
Stefan Henseler b8bf421dc2 Fixes missing diskblocksize parameter for gen1 vms 2018-04-18 22:14:44 +02:00
Megan Marsh 3afb243f11 use build name to ensure that winrm password and other shared state is not overwritten if two builders need the password in the same packer run. 2018-04-16 13:41:17 -07:00
Seth Vargo b17b333e29
Add a common package for specifying useragent and adopt that everywhere
There were 5 different formats for the Packer useragent string. This
fixes that and unifies it into a helper package.

I did not touch oracle's user-agent, because it looked kinda special.
2018-04-05 14:28:50 -04:00
Hannu Piki 3ffaf551c0 Fixing Hyper-V ISO builder CopyExportedVirtualMachine PowerShell
Script wasn't able to handle path that Packer used to create VM in the first place:
"==> hyperv-iso: Copying to output dir...
==> hyperv-iso: Error exporting vm: PowerShell error: Move-Item : An object at the specified path C:\Users\HANNU~1.PIK does not exist.
==> hyperv-iso: At C:\Users\hannu.piki\AppData\Local\Temp\ps520830935.ps1:13 char:1
==> hyperv-iso: + Move-Item -Path "$srcPath/$vhdDirName" -Destination $dstPath -Verbose
==> hyperv-iso: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
==> hyperv-iso:     + CategoryInfo          : InvalidArgument: (:) [Move-Item], PSArgumentException
==> hyperv-iso:     + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.MoveItemCommand"

Used path was: C:\Users\HANNU~1.PIK\AppData\Local\Temp\packerhv616791918\export253729206\2016min
Real path was: C:\Users\hannu.piki\AppData\Local\Temp\packerhv616791918\export253729206\2016min
2018-03-29 18:34:14 +03:00
Stefan Henseler 03f0b4aa11 Fixes minor typo 2018-03-25 16:30:03 +02:00
Stefan Henseler d31e35075e Removes obsolete code 2018-03-25 16:27:57 +02:00
Megan Marsh d689e6b4d3 allow users of AWS to use the dynamically-generated admin password which we use as the winRM password as an elevated password in the Powershell provisioner, as well as an environment variable in same provisoner. 2018-03-14 15:58:12 -07:00
Josh Soref 5178dd36e8 spelling: regular 2018-03-14 02:19:10 +00:00
Stefan Henseler a6b0bd2927
Merge branch 'master' into hyper-v-disk-block-size 2018-02-23 20:21:22 +01:00
Stefan Henseler 103186af86 Adds Support to configure hyper-v disk block size 2018-02-23 20:19:26 +01:00
Anthony Allen f3c361de6b Fully qualify hyper-v powershell commands 2018-02-07 08:01:05 +01:00
SwampDragons 7d5d62d748
Merge pull request #2906 from arizvisa/GH-2377
Improved support for downloading and validating a uri containing a Windows UNC path or a relative file:// scheme
2018-02-05 09:53:47 -08:00
Ali Rizvi-Santiago 9eb2f37429 Ack! Forgot to include the test-fixtures/SomeDir/myfile.txt file... 2018-02-02 20:44:22 -06:00
Ali Rizvi-Santiago d4b00b722a Removed an extra '/' from the TestFileExistsLocally test in common/config_test.go 2018-02-02 20:36:08 -06:00
Ali Rizvi-Santiago efc97dbda2 Fixed TestFileExistsLocally tests in common/config_test.go so that they're actually being run. Added a non-existent-protocol:// test. 2018-02-02 20:29:10 -06:00
Ali Rizvi-Santiago c366a1e160 Inverted the logic of FileExistsLocally as suggested by @SwampDragons as remote URLs are assumed to exist locally. 2018-02-02 20:17:24 -06:00
Ali Rizvi-Santiago c98a074f0d Renamed common/config.go's SupportedURL to SupportedProtocol as suggested by @SwampDragons. 2018-02-02 18:58:42 -06:00
Ben Phegan 3c88e787df
Merge branch 'master' into hyperv_mac_address 2018-02-02 09:26:52 +11:00
Matthew Hooker 8cd403425e
test fixes WIP 2018-01-24 17:09:17 -08:00
Matthew Hooker 5d48d658b4
Wire context through misc steps
Some steps actually need to pass the context around, so let's create
a ctx variable and pass it.
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
Ali Rizvi-Santiago 0e0b467da7 Forgot to check some errors during the adding of files to the floppy disk. This gives users some better information in case packer is unable to add a file...like if there's not enough disk space available. 2018-01-19 13:34:01 -06:00
Ali Rizvi-Santiago 97fc9c02a5 Grr...missed the case that actually mattered on linux. 2018-01-18 23:58:24 -06:00
Ali Rizvi-Santiago f9572cb244 Fixed a bug on linux related to forgetting to check the platform for the forward-slash prefix. 2018-01-18 23:48:20 -06:00
Ali Rizvi-Santiago 41f4dc3f3d umm...gofmt -w on common/config{,_test}.go from linux instead of windows(?) 2018-01-18 23:33:44 -06:00
Ali Rizvi-Santiago 7cd5d576d9 Updated common/config.go's FileExistsLocally implementation to use the LocalDownloader interface for determining the real file path. 2018-01-18 23:18:55 -06:00
Ali Rizvi-Santiago 8a102a42a0 gofmt -w on common/config{,_test}.go 2018-01-18 23:09:53 -06:00
Ali Rizvi-Santiago 15079a99dc Fixed common/config_test.go tests for DownloadableURL to avoid writing to disk on the windows platform. Also added tests for relative paths/uris.
common/config_test.go:
    Replaced instances of os.Mkdir and os.Create with tests that use
        the existing "common/test-fixtures" mechanism.
    Removed the runtime.GOOS test for the "FileExistsLocally" test,
        as the functionality should work regardless of the platform.
    Added some more comprehensive tests for the relative uri/pathing.
    Replaced the Windows Object Manager name test as the Object
        Manager's naming scheme is different from a UNC path.
    Modified the FilePaths tests to support the policy of windows absolute
        paths being prefixed with the `/` introduced with PR #5761.
2018-01-18 23:08:22 -06:00
Ali Rizvi-Santiago 95f60f6153 Modified common/config.go to accommodate some of the new DownloadableURL policies made by the PR #5761 merge.
common/config.go:
    Added the ability for DownloadableURL to promote UNC paths to the SMB uri.
    Modified DownloadableURL to include the "./" prefix when a relative path is passed to it.
    Fix-up the DownloadableURL argument if on windows and incorrectly prefixed with "/".
2018-01-18 22:43:08 -06:00
Ali Rizvi-Santiago 50e9cd2ca7 Initial fixes of common/config.go after rebase before refactoring of test-cases so that they don't require root to run. 2018-01-16 13:46:27 -06:00
Ali Rizvi-Santiago c17f827e1d Split up DownloadableURL() into it's individual components: SupportedURL(), DownloadableURL(), and ValidatedURL(). Updated all instances of DownloadableURL() to point to ValidatedURL(). Reverted the tests that are based on un-supported protocols. 2018-01-16 13:37:32 -06:00
Ali Rizvi-Santiago 3cf448f6ec Reverted previously removed additions of tests that check for ftp:// or nonexistent-protocol:// using DownloadableURL. DownloadableURL's responsibility is not to have inherent knowledge of protocols that are available, but to format an invalid url/path to a valid url/path. 2018-01-16 13:37:32 -06:00
Ali Rizvi-Santiago 4a1fb0d262 Grrr...gofmt -w common/*.go 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago 5d97b105a8 Removed implementation of the ftp protocol and the usage of cheggaaa's progress-bar as suggested by @SwampDragons. Replaced some of the old smoke-tests that were based on the ftp-protocol non-existing with a "non-existent://" protocol that's guaranteed to not exist. 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago 5a3e98b529 Updated the testcases in common/download_test.go to pass a non-nil progress-bar due to the removal of a pointer type in commit ed2e341b7d7f49a063dd5018701b4ae548b8ec14 from yesterday. 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago ab4490b967 Consolidated progress bar's appearance into the GetDefaultProgressBar() function. Updated dependency for cheggaaa's progress-bar from the gopkg.in location to the better maintained one on github.com. 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago 8c6efe336c Added second argument for custom-formatted progress-bar to NewDownloadClient in common/download_test.go. This second parameter was added as a result of commit f0bd9018f3e318caafb1fe7d46e04c470e07c092 which lets you customize the progress-bar format. 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago 69e5eec1ce Consolidated the progress-bar's format into common/step_download.go. Removed DownloadClient's PercentProgress callback since cheggaaa's progress-bar already does that. 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago d85883582f Changed a critical error to a non-critical one when dealing with the strange .CopyFile flag in common/download.go. 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago c978e27f0f grr. removed an assignment that was dead in common/download.go. 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago 5a4ce2165c Modified common/download_test.go to not test the smb:// uri on platforms other than windows. Added an immediate platform error to SMBDownloader.Download as opposed to letting .toPath return it (which would have left the structure partially initialized). 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago 4783b6508e Fix common/download_test.go to avoid formatting the volume name to a hidden windows share when not on windows. 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago b1ff14714b go fmt 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago 11ff4439a6 Moved the setting of HTTPDownloader's current progress to after the object actually gets instantiated. ;) 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago 0fa6c3782e Added a progressbar using gopkg.in/cheggaaa/pb.v1 as per #3578 for all the DownloadClients in common/download.go. 2018-01-16 13:37:31 -06:00
Ali Rizvi-Santiago 2f1104625d Fixed some of the unit-tests in common/ due to the changes made in {config,download}.go
config.go:
Fixed some issues related to the url scheme not being lowercased which broke some of the tests.

config_test.go:
Removed the UNC share test for \\host\share\file since SMB support has been moved to a different uri scheme.

download_test.go:
Explicitly set the CopyFile configuration option for all the unit-tests that test file copying capability.
Removed the UNC share testcase since it's under a different uri scheme now.
Modified the file:// UNC share testcase to explicitly test the smb:// uri.
Changed the incorrect t.Errorf calls to t.Logf so that the tests can pass.
2018-01-16 13:37:30 -06:00
Ali Rizvi-Santiago 6170e24ecb Refactored the code a bit to move the CopyFile hack out of DownloadClient and instead into each protocol.
config.go:
Removed all of the windows-specific net/url hackery since it's now handled mostly by download.go
Removed the replacement of '\' with '/' since url.Parse does it now.
Added knowledge of the other protocols implemented in download.go (ftp, smb)
Removed some modules that were unused in this commit.

download.go:
Moved the file-path conversions for the different protocols into their own internally callable functions.
Shuffled some of the functions around in case someone wants to implement the ability to resume.
Modified DownloadClient.Get to remove the CopyFile special case and trust the protocol implementations if a user doesn't want to copy the file.
Since all the protocols except for HTTPDownloader implement Cancel, added a Resume method as a placeholder for another developer to implement.
Added a few missing names from their function definitions.
Fixed the syntax in a few lines due to my suckage at go.
Adjusted the types for progress and total so that they support 64-bit sizes.
Removed the usage of the bufio library since it wasn't really being used.
2018-01-16 13:37:30 -06:00
Ali Rizvi-Santiago 60831801a7 Added the file, ftp, and smb downloaders to common/download.go 2018-01-16 13:36:18 -06:00
Ali Rizvi-Santiago da9c94b345 Added some testcases for the various file uri transforms to download_test.go
Moved some of the code for normalizing a Windows file uri to a regular path into it's own function NormalizeWindowsURL
2018-01-16 13:36:18 -06:00
Ali Rizvi-Santiago 281dd1258a Added proper support for downloading via a Windows UNC path or a relative uri.
Added proper support for validating a downloadableURL containing a UNC or relative uri.
Removed the workaround for an earlier Go issue that had remained dormant in common/download.go (issue #5927).
When building a .vmx file via the vmware-iso builder, transform the path to the correct os-formatted one (using filepath.FromSlash).
2018-01-16 13:36:17 -06:00
SwampDragons fb730cf521
Merge pull request #5761 from hashicorp/fix_5713
fix nasty edge case where we can't find guest additions on windows if they are on a different drive
2018-01-11 11:48:26 -08:00
Megan Marsh bdd186fa2b add tests for fileexistslocally helper function 2018-01-10 16:44:27 -08:00
Megan Marsh 3ace5bb91b simplify FileExistsLocally 2018-01-10 16:11:17 -08:00
Megan Marsh 55ddbf4765 sloppy copypasta 2018-01-10 10:08:23 -08:00
Megan Marsh 898dadd53c re-add this block. I still don't think we need it but I don't want to risk breaking things with this bugfix. 2018-01-10 10:03:36 -08:00
Megan Marsh a04a921c2d add UNC path to test cases, so I can try to enable it in future 2018-01-09 17:14:32 -08:00
Megan Marsh 154973241f add a bunch of windows filepath tests 2018-01-09 16:57:52 -08:00
Megan Marsh 40f0cc6dfe I don't think this is needed anymore 2018-01-09 15:53:54 -08:00
Megan Marsh 2838a2371d disambiguate url variable from url library 2018-01-09 15:47:18 -08:00
Megan Marsh 216c44b153 fix FileExistsLocally 2018-01-09 15:47:07 -08:00
Megan Marsh a3d5d40f78 reformat TestDownloadableURL into a table test to allow adding more URLS 2018-01-05 11:06:26 -08:00
Megan Marsh 4f3b470804 add helper function to manage validation of filepaths created using DownloadableURL 2018-01-03 16:53:47 -08:00
Megan Marsh 54bd057bb9 fix nasty edge case where we can't find guest additions on windows if they are on a different drive 2018-01-03 14:34:11 -08:00
Ben Phegan c338cb79d0 Initial commit of feature to allow MAC address specification for HyperV builders 2017-12-15 13:24:15 +11:00
SwampDragons 72afc2eab3
Merge pull request #5632 from VladRassokhin/do-not-donwload-twice
Do not re-download iso multiple times from different urls
2017-11-29 11:58:14 -08:00
Vladislav Rassokhin af8a0c46c5 Do not re-download iso multiple times from different urls
In case of two or more iso_urls checks for downloaded files prior to downloading them.
Speedups case when some iso already downloaded and another url prepended to iso_urls list.
2017-11-26 00:10:34 +03:00
Vijaya Bhaskar Reddy Kondreddi b7e3f37b44 Add support for differential disk 2017-11-24 12:44:53 +05:30
Megan Marsh 3c20176dbb runtime imported but not used 2017-11-16 11:12:23 -08:00
Megan Marsh 4fb8a27879 remove the actual offending code 2017-11-16 11:03:10 -08:00
Megan Marsh 74a4cc04fe fix regression :( 2017-11-16 10:22:12 -08:00
SwampDragons 2f9a6a99bd
Merge pull request #5578 from paboldin/do-5577
iso_config: allow for subdirs in hash sum files
2017-11-15 13:33:13 -08:00
Megan Marsh 0efcb1bba2 dont error in the downloadableURL function; save validation for preflight steps 2017-11-13 12:42:57 -08:00
Megan Marsh 3a9dfb5b18 better 2017-11-13 12:42:57 -08:00
Megan Marsh e45a006d61 clearly state that url is wrong at validation stage of build 2017-11-13 12:42:57 -08:00
Pavel Boldin 853b04420c iso_config: allow for subdirs in hash sum files
Allow hash sum files and ISOs to be in different directories as
Ubuntu does.

Signed-off-by: Pavel Boldin <boldin.pavel@gmail.com>
2017-11-13 09:28:43 +02:00
Matthew Hooker 68fa09c308
Merge pull request #5512 from hashicorp/fix5501
builder/virtualbox-ovf retry removing VM.
2017-11-06 15:56:08 -08:00
Matthew Hooker f64fa7b5ba
Merge pull request #5491 from BenPhegan/hyperv-disk_additional_size
Hyper-V disk_additional_size capability
2017-10-31 08:42:07 -07:00
Matthew Hooker a66f51f025
Merge pull request #5517 from PatrickLang/hyperv-gen2-autocheckpoint
Fixing auto checkpoints for generation 2 VMs.
2017-10-30 09:33:16 -07:00
Patrick Lang 6d5f75e118 run gofmt 2017-10-25 21:47:14 -07:00
Patrick Lang 95d82b4637 Fixing auto checkpoints for generation 2 VMs. Resolves #5506
Also cleaning up ifs
2017-10-25 21:21:32 -07:00
Matthew Hooker 812fd12a0b
move trimspace to powershell exit check 2017-10-25 13:28:59 -07:00
Matthew Hooker fb098d045d
builder/virtualbox-ovf retry removing VM.
moves behavior from builder/virtualbox-iso into the driver
so it is automatically available to callers.
2017-10-25 10:27:33 -07:00
Matthew Hooker 0be02ab217
hyper-v: Don't error while checking for admin permissions. 2017-10-25 09:18:40 -07:00
Ben Phegan 12fc928e1d Initial commit of Hyper-V disk_additional_size capability. Support a
maximum of 64 disks added to the SCSI controller.  Implement #4823.
2017-10-23 08:26:35 +11:00
Vijaya Bhaskar Reddy Kondreddi 4f6a207441 go fmt 2017-10-11 22:10:39 +05:30
Taliesin Sisson efa62e1550 Can specify an iso, vhd or vhdx for download. If it is a vhd or vhdx it is used as the hard drive for spinning up a new machine, importing an exported virtual machine or cloning a virtual machine.
Can import a virtual machine from a folder
Can clone an existing virtual machine
2017-10-11 22:05:45 +05:30
Taliesin Sisson 452fcbd9a1 Only attach dvd drive if there is one
Fix debug messages for cloning

Add hyperv-vmcx as a builder from command line
2017-10-11 21:42:32 +05:30
Taliesin Sisson 429e1bc3ad Adding an ISO is now optional for hyperv vmcx
Add documentation for hyperv vmcx
2017-10-11 21:42:32 +05:30
Taliesin Sisson 6fd7f0877d Initial check in to add a builder that can clone existing hyper v machines 2017-10-11 21:42:32 +05:30
Matthew Hooker 150b1522f4 Merge pull request #5374 from PatrickLang/hyperv-checkpoint
Disabling automatic checkpoints in hyperv-iso builder
2017-10-09 14:05:16 -07:00
Patrick Lang 6acdb9d148 Disabling automatic checkpoints
Signed-off-by: Patrick Lang <plang@microsoft.com>
2017-09-21 14:51:38 -07:00
Sander Saares 028c941b77 Enable use of separate temp path for Hyper-V VHD 2017-09-02 14:55:00 +03:00
Rickard von Essen 97498f80be
core: iso_checksum_url should strip query param
When iso_urls contains query parameters these should be stripped when
searching the content of iso_checksum_url for a maching checksum.

Closes #5176
2017-07-27 07:21:39 +02:00
Matthew Hooker 94d7a4ce8d
post-processor/vagrant-cloud: try upload once
* fixes multiple uploads mentioned in #4973
* removed unused token code
2017-06-12 17:34:32 -07:00
Petrik van der Velde aa33740ffb Removing the check for administrator rights from the script that sends keystrokes to Hyper-V.
Because Packer has already verified that we are running with at least Hyper-V administrator rights this should
be safe. Having the requirement for administrator rights in the script means that you still need to be an
administrator if you want to use packer to build Hyper-V images with a configuration that requires you to
send keystrokes to the MV, say when building a Linux box.
2017-04-15 11:04:15 +12:00
Matthew Hooker 81522dced0
move packer to hashicorp 2017-04-04 13:39:01 -07:00
Matthew Hooker 35578d9ed1
remove unnecessary type conversions 2017-03-28 20:36:21 -07:00
Matthew Hooker 79287d7e47
simplify some code 2017-03-28 20:36:20 -07:00
Matthew Hooker 230079f73a
spell fixes 2017-03-28 20:36:19 -07:00
Matthew Hooker 0ad6b169bc
builder/virtualbox: retry removing floppy controller 2017-03-23 23:58:23 -07:00
Matthew Hooker 262c8dc24a
WIP fix #4670 2017-03-16 14:18:41 -07:00
Matthew Hooker 22d1322bd9
always check for an error first when walking a path 2017-01-26 16:32:21 -08:00
Matthew Hooker 56115ee270 Merge pull request #4398 from mitchellh/portinclusive
step_http_server: make port range inclusive
2017-01-19 13:38:27 -08: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 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
Matthew Hooker 36b436b2b7
make port range inclusive 2017-01-13 14:22:25 -08:00
Taliesin Sisson 3824ea157d Merge pull request #4317 from Tadas/fix-ps-noprofile
Add -NoProfile switch for PowerShell execution
2017-01-12 22:47:49 +00:00
Tadas Medisauskas 088d3d1ac8 Add -NoProfile switch 2016-12-22 14:50:17 +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
Matthew Hooker 45d4cf8b36
move powershell module to common 2016-12-12 18:34:15 -08:00
Taliesin Sisson e5510873bb Added file with correct line endings
When dealing with windows the file url format is file:///c:/
On windows a lot of git clients will convert LF to CRLF. This would be a problem where file contents are compared exactly
2016-12-12 22:44:51 +00:00
Vasiliy Tolstov 7f391a94aa unbreak glob pattern in floppy_files
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-11-21 16:29:14 +03:00
Matthew Hooker d920b3fbf4 run gofmt 2016-11-01 14:08:04 -07:00
Matthew Hooker 97688a96ba Merge pull request #4004 from mitchellh/parseCheckSumFilePanic
fix parseCheckSumFile panic
2016-10-14 15:50:07 -07:00
Ali Rizvi-Santiago 1347b11f06 Fixed a bug due to some missing filepath.ToSlash calls in StepCreateFloppy.Add.
If backslashes were in a filename (such as when running from Windows),
    this would cause the backslashes to be included in the filenames in the
    created floppy disk which caused havoc when Windows tried to parse it.

Fixed a bug in fsDirectoryCache when using path.Clean() to normalize the
    input directory properly. This would cause an error where a new directory
    "." would be created instead of it correctly returning the root directory.

Fixes issue #3977.
2016-10-14 14:17:49 -07:00
Matthew Hooker 54651e0005 fix parseCheckSumFile panic
resolves #3516
2016-10-14 00:56:05 -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 a9abe43325 builder/amazon: add retry login when creating tags.
also move Retry from builder/googlecompute/common to common/retry
2016-09-28 18:22:31 -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
Orivej Desh 4fe86244a5 Improve -on-error descriptions 2016-09-18 03:00:36 +00:00
Orivej Desh 639bf356aa Fail on unknown values of -on-error 2016-09-17 14:42:21 +00:00
Orivej Desh 389603cc0f Allow upper case input to -on-error=ask 2016-09-16 12:15:00 +00:00
Orivej Desh 115cb5080f Document NewRunner 2016-09-16 12:15:00 +00: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 fbe305cf4e Renamed floppy_contents to floppy_dirs as requested by rickard.von.essen@gmail.com 2016-09-12 12:07:35 -05:00
Ali Rizvi-Santiago 915b7f371a Added missing argument to step_create_floppy_test.go 2016-09-12 11:57:51 -05: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
Ali Rizvi-Santiago 7d360d4e67 Added support for recursively including subdirectories in common/step_create_floppy.go
Shuffled the s.FilesAdded counter around so that unit-tests for common/step_create_floppy.go work without having to implement the fix properly.
2016-09-12 11:22:50 -05:00
Ricard Clau acededfc6e tests actually test the floppies 2016-07-27 21:59:21 +01:00
Chris Bednarski 1d31d2d8d4 Merge pull request #3674 from yoctocloud/file_scheme
common/download.go: allow to specify relative path for file scheme
2016-07-06 11:16:55 -07:00
Vasiliy Tolstov 4392f6df1c common/download.go: allow to specify relative path for file scheme
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-07-06 13:03:39 +03:00
Vasiliy Tolstov 82c63bd723 iso_checksum: fix parsing with absent newline
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-07-03 12:06:31 +03:00
Rickard von Essen abb2d92c7e Removed ftp/ftps schemas since they don't work. 2016-02-09 13:02:42 +01:00
Rickard von Essen bbade5d8ae Added "iso_checksum_url" and keep the functionality of "iso_checksum"
Added support for file shema in "iso_checksum_url".
Added some unit tests and updated the docs accordingly.
2016-02-08 19:35:50 +01:00
Vasiliy Tolstov 00fcc3dfdc allow to specify checksum via url
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2016-02-08 19:35:50 +01:00
Chris Bednarski 24dc798cfb Revert "Prevalidate Hardware Specs on Linux"
This reverts commit eda84cb2d3.
2016-02-02 12:41:43 -08: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
Mark Peek cdcffecc2d Refactor builder ISO options
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.
2015-10-20 16:27:47 -07:00
Chris Bednarski 1764238c0b Added [DEBUG] prefix to log messages 2015-08-19 13:15:23 -07:00