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
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.
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
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, /' {} \;`
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.
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 "/".
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.
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.
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).