Commit Graph

442 Commits

Author SHA1 Message Date
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
Chris Bednarski 6e8c6a15ad Implement fix, add comments so it's more apparent why we're doing special logic 2015-08-14 17:49:08 -07:00
Chris Bednarski 7ecfb057ff Added test case to catch deleting local source file when checksum doesn't match 2015-08-14 17:37:57 -07:00
Chris Bednarski 424ee65866 Added a log message when we use a local file instead of downloading one 2015-08-14 17:34:39 -07:00
Chris Bednarski 70af28be47 Added cake fixture for testing file:/// downloads 2015-08-14 17:34:04 -07:00
Mitchell Hashimoto 0416939c08 common: always reset progress to 0 for downloads 2015-06-22 14:59:38 -07:00
Mitchell Hashimoto 117579808f common: add the current progress to the total size 2015-06-22 14:58:27 -07:00
Mitchell Hashimoto 944b4bf46c common: delete file if checksum fails 2015-06-22 12:17:29 -07:00
Mitchell Hashimoto 2f530534d2 common/download: resume test 2015-06-22 12:14:35 -07:00
Mitchell Hashimoto aa7d3b7841 Merge pull request #2245 from vtolstov/iso
resume download after fail
2015-06-22 12:03:47 -07:00
Mitchell Hashimoto bf456f35f9 common: download client tests
/cc @cbednarski
2015-06-22 12:02:38 -07:00
Mitchell Hashimoto 897888fde3 common: fix potential panic case 2015-06-21 19:58:18 -07:00
Vasiliy Tolstov d98de209cb fallback to not ranged request if server lacks HEAD
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2015-06-16 01:04:48 +03:00
Mitchell Hashimoto 2d13db300c packer: HookProvision errors if no communicator 2015-06-15 10:26:46 -07:00
Vasiliy Tolstov 382fa01e6f resume download after fail
close #2106

Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2015-06-15 09:53:16 +03:00
Mitchell Hashimoto a1ceb5a7ef common: remove StepConnectSSH 2015-06-13 18:10:37 -04:00
Mitchell Hashimoto 71d8c6610a Merge pull request #1968 from bhcleek/master
do not request a pty
2015-06-13 16:23:31 -04:00
Mitchell Hashimoto 1e853f9f1f common: revert some changes from #2121 for Windows 2015-06-13 10:21:09 -04:00
Clint Shryock 04e174fae8 builder/amazon: Properly return error code on ssh errors 2015-06-11 16:21:29 -05:00
Mitchell Hashimoto f6f9cca7ce Merge pull request #2189 from mitchellh/b-download-extension
common: StepDownload can force an extension
2015-06-09 20:56:43 -07:00
Mitchell Hashimoto 23a48d6619 go fmt 2015-06-08 21:34:20 -07:00
Mitchell Hashimoto e65e2d104a common: StepDownload can force an extension 2015-06-08 20:41:39 -07:00
jszwedko b1497b951c code.google.com/p/go.crypto/ssh -> golang.org/x/crypto/ssh
code.google.com/p/go.crypto/ssh is now at golang.org/x/crypto/ssh as of
https://code.google.com/p/go/source/detail?spec=svn.crypto.69e2a90ed92d03812364aeb947b7068dc42e561e&repo=crypto&r=8fec09c61d5d66f460d227fd1df3473d7e015bc6

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

This is a precursor to a PR for #1066.
2015-05-28 08:17:49 -07:00
Mitchell Hashimoto 44008c321b Merge pull request #2121 from josharian/no-scrub-empty
common: two minor fixes
2015-05-27 20:17:51 -07:00
Mitchell Hashimoto adb6b43dd8 common: remove unused config methods 2015-05-27 14:58:09 -07:00
Mitchell Hashimoto dd0a775500 common/command: delete 2015-05-26 09:51:47 -07:00
Josh Bleecher Snyder 2fe785ed35 common: remove dead code
The referenced bug was fixed in Go 1.2,
and Packer requires Go 1.2+.
2015-05-18 15:13:36 -07:00
Josh Bleecher Snyder 76c8cfd498 common: don't scrub ""
If the access_key or secret_key were loaded from
somewhere other than the packer file then
ScrubConfig can get called to scrub "" and "".

This results in very long output:

<Filtered><<Filtered>F<Filtered>i...

Don't do that.
2015-05-18 15:13:01 -07:00
Grégoire Pineau 97c56347a1 Better error reporting when a config key in template is Unknown
This patch will allow to fix the following bug much faster:

```
1 error(s) occurred:

* Unknown configuration key: output_directory
```

Related configuration:

```
"output_directory ": "build/sl_base/",
```

After the patch, the error reporting will be:

```
1 error(s) occurred:

* Unknown configuration key: "output_directory¤"
```
2015-03-05 10:23:21 +01:00
Emil Hessman 952ae5161b common: fix formatting directives in tests
Fixes the following vet reports:

common/step_create_floppy_test.go:79: possible formatting directive in Fatal call
common/step_create_floppy_test.go:89: possible formatting directive in Fatal call
common/step_create_floppy_test.go:180: possible formatting directive in Fatal call
common/step_create_floppy_test.go:190: possible formatting directive in Fatal call
2015-02-25 05:43:18 +01:00
Billie H. Cleek 2184892f8a do not request a pty
Change the default behavior from requesting a PTY when executing a
command with the ssh communicator to requesting a PTY only when
configured to do so.

Update the vmware builders to be fully backward compatible with the new
behavior.
2015-02-12 20:18:54 -08:00
Seth Vargo 347f02a7f2 Merge pull request #1402 from jasonberanek/858-issue
fix build name ConfigTemplate processing [GH-858]
2014-11-26 16:30:36 -05:00
Mitchell Hashimoto 8dbe0f065c Remove version from "packer" package 2014-10-27 20:51:34 -07:00
Mitchell Hashimoto 42e9e734b9 common: don't wait SSH on first try 2014-09-10 14:04:56 -07:00
Mitchell Hashimoto 01abbc4460 common/ssh: error if encrypted key is used 2014-09-03 20:25:31 -07:00
Mitchell Hashimoto 76a8221636 builder/*: extract key path to ssh.Signer 2014-09-03 20:23:39 -07:00
Jason A. Beranek 56ec6bf7af common/command/template,packer/template: fix build name ConfigTemplate processing [GH-858] 2014-08-09 21:52:33 -05:00
Mitchell Hashimoto 34834057c3 common: add test for empty val 2014-05-06 18:52:02 -07:00
Mitchell Hashimoto 5c5d62733f fmt 2014-05-01 14:24:19 -07:00
Ross Smith II 3d960ccc69 go fmt 2014-04-29 12:29:15 -07:00
Ross Smith II e422d45f92 Allow wildcards and directories for floppy_files parameter 2014-04-29 12:27:34 -07:00
Mitchell Hashimoto 5cd2cfa563 comment so future-mitchell knows what I've done 2014-04-28 16:19:35 -07:00
Mitchell Hashimoto ba05119a75 common: user variable conversion to non-string types works [GH-1079] 2014-04-28 16:18:45 -07:00
Mitchell Hashimoto d5981c69f2 common: config strings to slices [GH-950] 2014-04-27 14:47:16 -07:00
Mitchell Hashimoto 5dec2ddb9c common: weakly decode the PackerConfig 2014-04-26 14:23:22 -07:00
Mitchell Hashimoto fa339fc275 get more proper SSH package usage in 2014-04-26 11:23:26 -07:00
Mitchell Hashimoto 5fac6c79c4 fmt 2014-04-26 11:12:43 -07:00
Mitchell Hashimoto e84e5e4f2c Merge branch 'update-ssh-package' of github.com:higebu/packer into higebu-update-ssh-package
Conflicts:
	builder/amazon/common/ssh.go
	builder/digitalocean/ssh.go
	builder/googlecompute/ssh.go
	builder/openstack/ssh.go
	communicator/ssh/communicator_test.go
	communicator/ssh/keychain.go
	communicator/ssh/keychain_test.go
2014-04-26 11:12:06 -07:00
Mitchell Hashimoto 8395d0e97a common: tests for ChooseSTring 2014-04-21 21:30:49 -07:00
Mitchell Hashimoto 7191c1f250 common: Fix URL parsing issues on Windows 2014-04-21 21:28:47 -07:00
Mitchell Hashimoto 159587daf4 Merge pull request #768 from devcamcar/openstack-env-support
builder/openstack: Add support for standard OpenStack environment variables
2014-04-21 21:11:37 -07:00
Fabian Ruff 2a3393ca84 fix error handeling when creating a floppy 2014-04-17 23:34:55 +02:00
higebu f087ce16dc Fix the build problem by updating ssh package 2014-04-15 10:17:26 +09:00
Ross Smith II 27491f93f8 use old ssh code until higebu's branch is ready, see #1019 2014-04-11 08:23:12 -07:00
Mitchell Hashimoto 1087b5def8 common: clarify debug mode [GH-907] 2014-03-12 21:40:27 -07:00
Devin Carlen bef63846af Add support for standard OpenStack environment variables 2014-02-17 15:30:01 -08:00
Mark Rushakoff 4548495116 StepDownload uses packer version as user agent 2014-01-09 13:20:30 -08:00
Mark Rushakoff 9e5c0f6c6a HTTPDownloader uses UserAgent from DownloadConfig 2014-01-09 08:41:34 -08:00
Mitchell Hashimoto 107e47fe25 update commands to new user var syntax 2013-12-27 09:21:17 -07:00
Mitchell Hashimoto 4c6800f5a3 common: process user variables in non-string config decodes [GH-598] 2013-12-16 17:57:07 -08:00
Mitchell Hashimoto 48fb1f9dfb common: fix tests 2013-12-06 18:36:16 -08:00
Mitchell Hashimoto a380391b0e common: allow files that don't exist to be URLs [GH-683] 2013-12-06 18:31:56 -08:00
Mitchell Hashimoto 21bb0674f2 builder/docker: ctrl-C works during provisioning 2013-11-12 16:24:16 +00:00
Mitchell Hashimoto 483cda18c1 builder/vmware: make things more Go-like
This commit currently breaks the builder though, since the ISo is now
uploaded back into ESX.
2013-11-07 12:01:18 -08:00
Doug MacEachern a828a9a064 builder/vmware: new driver to support building images directly on ESX
This driver talks directly to ESX over ssh, using vim-cmd, esxcli and sh;
no vCenter or VIM api required.

Remote* config properties added to support a remote driver

RemoteDriver interface extends Driver:
* SSHAddress - esx flavor uses esxcli to find the VM's ip address
* Download - esx flavor downloads iso files to a vmfs datastore

Driver can optionally implement the following interfaces:
* VNCAddressFinder - esx flavor needs to check remote ports
* OutputDir - esx driver needs a local and remote OutputDir
* Inventory - esx driver needs to register/unregister VMs
* HostIPFinder - esx flavor needs an address on the same network as esx itself
2013-11-07 12:01:18 -08:00
Mitchell Hashimoto 24db112b79 common: downloads can be HTTPS [GH-587] 2013-11-02 22:10:48 -05:00
Jonas Pfenniger 440e966c6e Simplifies the implementation of common/uuid 2013-10-23 23:05:02 +01:00
Jonas Pfenniger fa0a0a895f Fixes missing entropy in the uuid package.
math/crypto is seeded with 1 and thus will create predictable UUIDs. Because
amazon-instance and amazon-ebs in the same second when building both targets
the timestamp in front doesn't help either. See #552
2013-10-23 10:58:48 +01:00
Mitchell Hashimoto 5ecec18258 common/uuid: add test, albeit weak 2013-10-16 21:19:53 -10:00
Mitchell Hashimoto 79f7936d66 Remove dependency on identifier package, use time ordered UUID [GH-541] 2013-10-16 16:21:14 -10:00
Matthew Hooker 5315b19822 common/config: config filter function [GH-521]
Fixes #521
2013-10-13 11:01:12 -07:00
Patrick Lucas 7f0916b646 An SSH timeout should be treated as an error 2013-10-02 14:55:28 -07:00
Mitchell Hashimoto 877dfb81fe common: Allow user variables to be used for ints/bools/etc. [GH-418] 2013-09-18 16:18:39 -07:00
Mitchell Hashimoto 0b830c92ba common: Use new multistep API 2013-08-31 12:17:59 -07:00
Mitchell Hashimoto 0dc347c70d packer: implement Cancel in ProvisionHook 2013-08-30 23:39:29 -07:00
Mitchell Hashimoto 9f559cb25c common: detect ctrl-c in Provision 2013-08-30 23:28:31 -07:00
Mitchell Hashimoto 01e998a81c common: support SHA512 as checksum type [Gh-356] 2013-08-28 09:09:43 -07:00
Mitchell Hashimoto c753946c84 builder/vmware: ability to not request a PTY for SSH [GH-270] 2013-08-27 16:51:05 -07:00
Mitchell Hashimoto cf175b4733 communicator/ssh: respect interrupts by not looping on retyr [GH-327] 2013-08-22 11:53:31 -07:00
Mitchell Hashimoto 4c86547796 common/command: error if only/except points to bad build 2013-08-22 11:40:30 -07:00
Mitchell Hashimoto 9cc4137a19 common/command: more tests for filtering builds 2013-08-22 11:34:51 -07:00
Mitchell Hashimoto 6d9265a244 packer: add mock implementations and more template tests 2013-08-22 11:32:59 -07:00
Mitchell Hashimoto 8bbed8656a common: use HTTP proxy if available from env [GH-252] 2013-08-18 12:34:36 -06:00
Mitchell Hashimoto 9e01b5a478 common: detect drive letter with windows file URLs [GH-284] 2013-08-15 20:16:05 -07:00
Mitchell Hashimoto 349a83d6d6 common: Remove Template, in packer now 2013-08-15 19:11:42 -07:00
Mitchell Hashimoto 562ea28a79 builder/virtualbox: switch download guest additions to use new common 2013-08-15 17:46:40 -07:00
Mitchell Hashimoto bb352e5011 common: Add new StepDownload to DRY up downloads 2013-08-15 17:46:40 -07:00
Mitchell Hashimoto 71664cb34e common: return -1 download percent if download hasn't started [GH-288] 2013-08-14 11:15:47 -04:00
Mitchell Hashimoto 5166f511d2 common/json: add Unmarshal with method with syntax errors 2013-08-09 16:50:24 -07:00
Mitchell Hashimoto 398b8fc8d4 common/command: add -var-file support for user vars 2013-08-09 16:45:29 -07:00
Mitchell Hashimoto 56c36c12ed command/build,validate: pass user vars to Prepare 2013-08-09 15:57:09 -07:00
Mitchell Hashimoto 915c8cebae common/command: parse the "-var" flag 2013-08-09 15:57:08 -07:00
Mitchell Hashimoto 229eab0623 common/command: rename BuildFilters to BuildOptions 2013-08-09 15:57:08 -07:00
Mitchell Hashimoto 089df41aac common/command: introduce this package for common cmmand stuff 2013-08-09 15:57:08 -07:00
Mitchell Hashimoto 670c6c5c16 common: UserData => UserVars 2013-08-09 15:57:08 -07:00
Mitchell Hashimoto bbced21c36 common: PackerConfig understands user vars 2013-08-09 15:57:08 -07:00
Mitchell Hashimoto 4c2ada1e30 common: clone template during validation to avoid unnecessary children 2013-08-08 17:25:24 -07:00
Mitchell Hashimoto 7883d937a6 common: validation and generating unique template names 2013-08-08 17:25:24 -07:00
Mitchell Hashimoto 56728e6509 common: support user data 2013-08-08 17:25:24 -07:00
Mitchell Hashimoto 53d0095cb2 common: functions for template processing 2013-08-08 17:25:24 -07:00
Mitchell Hashimoto 2b41f05848 common: replace windows file URL backslash with forward slash
/cc @jasonberanek - Just adding this as well because I see this being
common as well.
2013-08-03 13:38:27 -07:00
Mitchell Hashimoto e2c667101c common: style 2013-08-03 13:34:48 -07:00
Jason A. Beranek 3fa5fa396a common/config,download: gofmt fixes 2013-08-02 16:06:06 -05:00
Jason A. Beranek 760f102c91 common/config,download: fix URL and relative Windows local file path issues [GH-235] [GH-239] 2013-08-02 15:59:19 -05:00
Mitchell Hashimoto 5b7d8fbc74 rename builder/common to common since it is generally useful 2013-08-01 12:11:54 -07:00