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 "/".