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
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