77 Commits

Author SHA1 Message Date
Chris Roberts
c8a7989b88 Adjust internal layout to allow downgrading
With the initial layout of `provider/architecture`, after installing a
box with architecture support downgrading Vagrant would result in it
being unable to process the box collection. Swapping the layout to be
`architecture/provider` allows downgrades to still properly process the
box collection.
2023-09-25 15:09:29 -07:00
Chris Roberts
3ea1beca9e Skip box directories without metadata file 2023-09-18 15:41:28 -07:00
Chris Roberts
51adb12547 Add architecture support for boxes
Introduce support for handling box architecture. Adds a new
`box_architecture` setting that defaults to `:auto` which will perform
automatic detection of the host system, but can be overridden with a
custom value. Can also be set to `nil` which will result in it fetching
the box flagged with the default architecture within the metadata.

Box collection has been modified to allow existing boxes already
downloaded and unpacked to still function as expected when architecture
information is not available.
2023-09-14 16:15:03 -07:00
Matt Kulka
f5e0c12bb9
use the -S flag with bsdtar for sparse extraction of boxes 2023-08-24 13:09:18 -07:00
hashicorp-copywrite[bot]
36a312ee26
add missing license headers and update copyright file headers to BUS-1.1 2023-08-10 21:53:25 +01:00
Chris Roberts
7d7ad89ac5 Provide helpful error message on invalid version
When a box version (or constraint) is provided with an invalid
format, rescue the error and return a customized error with
information for the user explaining the problem.
2022-09-21 11:21:24 -07:00
sophia
8ead293836
Enable box collection for server mode 2022-04-25 12:25:56 -05:00
sophia
0d1635303f Sperate hook for authenticating url and adding headers for authentication 2020-08-18 17:42:59 -05:00
sophia
b5f6df9ec0 Download a box by setting auth headers 2020-08-18 10:13:39 -05:00
steve-simpson
7b3ca04a6e Added --no-same-owner & --no-same-permissions flags to bsdtar in box_collection.rb 2019-03-01 18:02:37 +00:00
Brian Cain
6b9cdb4e48
Fixes #10663: Ignore boxes in collection with malformed version numbers
Prior to this commit, if a box some how got on disk that had an
incorrect or invalid version number that did not match Gem::Version,
Vagrant would throw an exception when attempting to generate a list of
the boxes on disk. This commit fixes that by looking at the version from
the path generated, and shows a warning to the user about the box and
skips it from the list so they at least know about the problematic box
and can still get a list of boxes.
2019-02-14 15:30:11 -08:00
Chris Roberts
3f23466703 Replace file separators when decompressing box files 2018-06-18 08:57:29 -07:00
Chris Roberts
009ca94167 Sort result of BoxCollection#all 2017-03-06 08:19:02 -08:00
David O'Rourke
a33892e4df Maintain a version dir map in box_collection.
This is required since Gem::Version will mangle pre-release version
numbers.
To get around this, we keep a mapping of
`Gem::Version.to_s => versiondir.`

This allows us to properly sort by version when picking a box while
still returning pristine versiondirs when required.
2016-11-01 15:59:23 +00:00
David O'Rourke
7b89374dce Fix version sorting in box_collection.rb 2016-11-01 14:57:06 +00:00
Seth Vargo
23e50c98f9
core/box_collection: Ensure removal
The docs for Ruby say Pathname#rmtree will recursively delete, but
apparently that is a lie, at least on Windows (see GH-7496). Switch to
using FileUtils to ensure the directory is deleted.

Fixes GH-7496
2016-06-20 07:16:08 -04:00
Mark Mickan
1378eebea9 Use pristine version string when constructing path to box
Without this change, the version string may be mutated when passed through
Gem::Version.new(version).to_s before being used to construct the box
directory.  This is a problem when using prerelease version numbers because,
for example, it will look for "~/.vagrant.d/boxes/1.0.0.pre.alpha.1" when it
should be looking for "~/.vagrant.d/boxes/1.0.0-alpha.1".
2016-01-20 10:22:00 +10:30
Mitchell Hashimoto
c541767949 core: add tests for box collection cleanup [GH-6002] 2015-11-19 15:59:58 -08:00
Ievgen Prokhorenko
562ed26533 Fix #3570 'Box data left in ~/.vagrant.d/boxes after removal' 2015-07-19 16:44:38 +03:00
Seth Vargo
345935887f Style fixes 2015-06-02 17:18:50 -04:00
Philip Wrenn
4c8fe42d70 Ignore possible version directories that are hidden folders, i.e. dot folders. 2015-06-02 17:09:10 -04:00
Seth Vargo
2f529d47e7 VMWare -> VMware 2014-10-21 18:37:53 -04:00
Mitchell Hashimoto
15f1823d5c core: box names with colons work on Windows [GH-4100] 2014-08-08 14:47:17 -07:00
Kalman Hazins
bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00
Mitchell Hashimoto
5b360d0990 core: BoxCollection#find version constraint can benil 2014-04-02 19:50:44 -07:00
Mitchell Hashimoto
7926f7f051 core: box URLs can be authenticated by hooking 2014-03-01 11:38:04 +01:00
Mitchell Hashimoto
4e90aa7824 core: copy all sub-directories in a box properly
This avoids an Errno::EACCES on windows, although I'm really unsure why.
2014-02-15 15:55:33 -08:00
Mitchell Hashimoto
f2509f5c65 commands/box: outdated command to find outdated boxes 2014-02-05 21:20:10 -08:00
Mitchell Hashimoto
bd9f375263 core: Box can store a metadata URL 2014-02-05 21:20:07 -08:00
Mitchell Hashimoto
e9afe386c1 core: remove BoxUpgradeRequired exception 2014-02-05 21:20:06 -08:00
Mitchell Hashimoto
b2fa785d07 core: Environment loads proper version of box 2014-02-05 21:19:51 -08:00
Mitchell Hashimoto
c31feb0e94 core: fix missing interpolation for boxcollection 2014-02-05 21:19:33 -08:00
Mitchell Hashimoto
15aa91b073 core: can add/search boxes with slashes in name 2014-02-05 21:19:17 -08:00
Mitchell Hashimoto
d87c414327 core: Box has a version field 2014-02-05 21:19:10 -08:00
Mitchell Hashimoto
87a85488d1 core: all box collection tests pass 2014-02-05 21:19:09 -08:00
Mitchell Hashimoto
4c1fa7359d core: BoxCollection can find with version constraints 2014-02-05 21:19:07 -08:00
Mitchell Hashimoto
77b5fa94b7 core: BoxCollection#all returns versions 2014-02-05 21:19:06 -08:00
Mitchell Hashimoto
b52d33e0af core: upgrade to v1.5 box dir format if it can 2014-02-05 21:19:04 -08:00
Mitchell Hashimoto
5253da79cd core: use a Monitor in BoxCollection 2014-02-05 21:19:03 -08:00
Mitchell Hashimoto
13c8235963 core: correct some doc comments 2013-12-31 08:19:43 -08:00
Michael Glass
9a00473029 fix regression preventing boxes that specify support for multiple formats.
don't know if this is the right place for this fix.  maybe formats should be an array of symbols.
2013-07-26 13:16:53 -07:00
Mitchell Hashimoto
cf0ba53fbb box_url works with all box formats a provider supports [GH-1752] 2013-07-19 00:50:00 -04:00
Mitchell Hashimoto
f3bbad8c2e Refactor box collection to support looking for boxes multi-provider 2013-07-19 00:50:00 -04:00
Anton Kalyaev
6c5a580006 more concise message for BoxNotFound error
Now we have different providers, but the error message didn't tell
anything about it. Suppose I want to remove one of my boxes:

    vagrant box remove opscode-ubuntu-12.04 vritualbox

There is a typo in provider name. The error message is:

    Box 'opscode-ubuntu-12.04' could not be found.

Therefore I need to double check the box name, and only than I will see
the typo.

This commit make the error message looks like this:

    Box 'opscode-ubuntu-12.04' with 'vritualbox' provider could not be
found.
2013-05-05 18:23:12 +04:00
Mitchell Hashimoto
ccfd321ef9 Properly convert provider name to symbol when searching for boxes
[GH-1691]
2013-05-04 09:51:13 -07:00
Mitchell Hashimoto
04d9872674 Improve the thread safety of BoxCollection 2013-04-19 23:48:05 -06:00
Mitchell Hashimoto
efaabea5c0 Use vagrant tmp directory for boxes [GH-1442] 2013-04-07 14:48:56 -07:00
Mitchell Hashimoto
998122e076 Box adding is done in a helper that ensures temporary files are cleaned 2013-04-07 14:43:52 -07:00
Mitchell Hashimoto
cf9eb509a9 Don't preserve modified time when untarring files [GH-1539] 2013-04-04 13:32:37 -07:00
Mitchell Hashimoto
7e125db669 Fix obscure error with world writable temp dir 2013-03-21 17:31:23 -07:00