Commit Graph

333 Commits

Author SHA1 Message Date
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