Commit graph

111 commits

Author SHA1 Message Date
oss-core-libraries-dashboard[bot]
614fcb0549
[COMPLIANCE] Update Copyright and License Headers (Batch 1 of 7) (#13765)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2025-12-22 16:38:56 +05:30
Chris Roberts
5543415424
Remove server mode checks
Remove service mode checks from command roots.
2025-04-24 13:04:07 -07:00
Chris Roberts
ea25996b21
Update Vagrant behavior outside of installers
Remove customized require behaviors and modify the bin executable
to check for missing tools that Vagrant expects to exist when
running outside of an installer.
2025-04-02 11:40:17 -07:00
Allison Larson
11ca740311 Fix output message for box missing metadata 2025-03-03 14:58:45 -08:00
Allison Larson
5564b8a1fd Determine compatible version when checking outdated box
When a request to check an outdated box (or update a box), add explicit
architecture compatibility check in addition to ensuring the version is
newer than before.

The architecture compatibility checks allow boxes that were marked as an
"unknown" architecture to see new "unknown" architectures as viable
update options, if an architecture specific provider is not available.
In the scenario that the existing version/provider has an explicit
architecture defined, a new version/provider with an "unknown"
architecture is not considered compatible.

This architecture check can be bypassed by explicitly setting
`config.vm.box_architecture = nil` in the Vagrantfile.
2025-03-03 14:58:45 -08:00
Allison Larson
834e84fa6e Include arch constraint when checking global outdated boxes 2025-02-26 15:59:56 -08:00
Chris Roberts
8b06640fcf
Use helper for require calls 2024-11-06 17:33:00 -08: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
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
Sophia Castellarin
9f9d2fdfcb
Merge pull request #12652 from t2sa/typo
Fix sentense
2023-02-14 12:12:27 -08:00
sophia
2513d21054
Return 0 when no boxes are installed
Previously the cli returned 1 for `vagrant box list` if there
are no installed boxes. This is somewhat misleading since the
command completes without an error, it should return 0
2022-04-25 12:26:02 -05:00
sophia
d95b563e86
Ensure 0 is returned for successful command 2022-04-25 12:25:57 -05:00
sophia
434cc89a95
Get rid of extra subcommand help message
The available subcommands are displayed using the option parser
in the vagrant client
2022-04-25 12:24:11 -05:00
sophia
633528318d
Get help from ui output 2022-04-25 12:23:58 -05:00
sophia
0c1e44f553
Get help from commands that have subcommands 2022-04-25 12:23:58 -05:00
Thilak Somasundaram
9c0c3acbae Fix sentense:
"that are you are using" to "that you are using"
2022-01-14 18:30:24 -08:00
Brian Cain
bcf4d5a210
Fixes #11228: Allow to force check for box updates
Prior to this commit, if a user had recently checked for updates, there
was no way to force Vagrant to re-check without manually deleting a
state file in the local `.vagrant` data dir. This commit fixes that by
giving users the ability to force check for updates for a given box with
a flag to the `vagrant box outdated` command.
2019-12-03 11:42:55 -08:00
Brian Cain
06799402ed
Fixup: Ensure Gem::Version.new does not receive nil value
This commit fixes an issue where Gem::Version.new could recieve a nil
value if no addtional box updates are available. For some versions of
ruby, this is actually an error case. This commit fixes that by
converting it to an integer to prevent an exception.

Issue reference: https://github.com/rubygems/rubygems/issues/2359
2019-11-14 14:51:29 -08:00
Jeff Bonhag
0e68f02dc9
Fixes #11163: Get latest version for provider (#11192)
This commit changes the behavior of `vagrant box outdated --global` so
it gets the latest version for the current machine's provider, rather
than the latest version for any provider.
2019-11-13 17:33:15 -05:00
Brian Cain
5210e9d82b
Update flag from used to active 2019-09-05 15:46:43 -07:00
Brian Cain
e19f54457d
Fixes #10908: Preserve in-use boxes when force flag is used with prune
Prior to this commit, `vagrant box prune --force` would not prompt a
user to prune Vagrant boxes, even if that box was in use. There was no
way to prune boxes, ignore the prompt, but keep in-use boxes. This
commit adds a new flag that can be combined with `--force`, that will
keep in-use boxes but prune older boxes without prompting the user.
2019-09-04 15:54:11 -07:00
Brian Cain
e2d017b219
Continue updating environment boxes if metadata not found
Prior to this commit, if a user ran a `vagrant box update` on their
entire environment and one of the boxes did not have a metadata file,
the rest of the boxes in the update would be skipped. This commit fixes
that by ignoring those boxes and showng a warning, so that the rest of
the boxes could check for updates.
2019-05-08 09:04:45 -07:00
Alex Goncharov
b75768fc56 Fix box version sort in Update.update_specific 2019-04-24 18:57:34 -04:00
Matt Adams
a3836f5fec Change remaining box_client_cert refs
This fixes issues with box add/update when self hosting with client
certs. The --cert option was not being added to the curl subprocess
in these cases.
2019-01-28 08:45:24 -06:00
Chris Roberts
ceb7a0b5ac When doing box lookup, use explicit provider, machine provider, then default 2018-08-02 16:41:28 -07:00
Chris Roberts
00b783a6a5 Lookup latest available installed box if required on update
When performing a box update and the box version has been updated
to be different than the installed version, perform a lookup for
the latest available installed box to allow the update command to
continue successfully
2018-08-02 16:12:10 -07:00
Brian Cain
11ddd0136d
(#9044) Show all box providers in command outdated
Prior to this commit, when the `--global` flag was used with the
`vagrant box outdated` command, it would ignore box providers and not
inform the user of all outdated boxes. This commit fixes that by
displaying each box within the users environment, and includes the
provider of the box in the message.
2018-01-08 09:43:28 -08:00
Brian Cain
324a08bd75 (#8719) Add force flag for box upgrade command
Prior to this commit, if a state was reached where the action_box_add
command needed a force flag, it would fail requesting the user to
provide that flag to override adding a new box. However that flag did
not exist on the box update command, and could not be passed onto the
action_box_add action. This commit updates that to include a force flag,
and if used, pass that value onto the action_box_add action.
2017-08-09 16:21:13 -07:00
Chris Roberts
5f955c3d38 Convert atlas references to vagrant cloud 2017-06-23 10:01:51 -07:00
Gökhan Şengün
51a15d23bd Correct box version sorting of box list command.
Boxes are already correctly sorted as a result of PRs #7956 and #8334. The extra sort here breaks.
2017-03-29 00:56:42 +03:00
Björn Brala
3ef9968c59 Add new prune command as discussed in: #6863 #5633
Usage: vagrant box prune [options]

Options:

    -p, --provider PROVIDER          The specific provider type for the boxes to destroy.
    -n, --dry-run                    Only print the boxes that would be removed.
        --name NAME                  The specific box name to check for outdated versions.
    -f, --force                      Destroy without confirmation even when box is in use.
    -h, --help                       Print this help
2016-11-09 09:19:49 +01:00
Renat Zaripov
d490d0a846 Fix operation name in help message 2016-06-08 15:05:09 +03:00
Seth Vargo
dab4537682
core/boxes: Do not update the same box twice
Vagrant's environment (which includes the known list of boxes and
versions) is established at the start of the Vagrant run. This means
that box downloads which occur during the run are not contained in the
set until the next run. This causes duplicate box downloads to raise an
error in multi-machine Vagrantfiles.

This commit fixes that issue by pre-processing the machines by provider
and version, creating a unique set of boxes to update.

Fixes GH-6042
2016-05-31 23:08:51 -04:00
Mitchell Hashimoto
32f6accb25 commands/box: don't halt on metadata download failure [GH-6453] 2015-11-19 18:50:50 -08:00
Mitchell Hashimoto
1ccd91aada Merge pull request #4473 from rtkrruvinskiy/https_metadata
Add HTTPS download options to `box update` and `box outdated`
2015-11-19 16:16:48 -08:00
Christian Berendt
3f4a372d57 Remove all available versions of a box
This patch introduces a new parameter --all for the remove
command of the box plugin. Setting this parameter will remove
all available versions of a specific box.

Example usage:

```
$ vagrant box list
ubuntu/trusty64 (virtualbox, 20150427.0.0)
ubuntu/trusty64 (virtualbox, 20150430.0.0)
ubuntu/trusty64 (virtualbox, 20150506.0.0)
```

```
$ vagrant box remove ubuntu/trusty64
You requested to remove the box 'ubuntu/trusty64' with provider
'virtualbox'. This box has multiple versions. You must
explicitly specify which version you want to remove with
the `--box-version` flag. The available versions for this
box are:

 * 20150427.0.0
 * 20150430.0.0
 * 20150506.0.0
```

With the --all parameter it is possible to remove all versions at once.

```
$ vagrant box remove --all ubuntu/trusty64
Removing box 'ubuntu/trusty64' (v20150506.0.0) with provider 'virtualbox'...
Removing box 'ubuntu/trusty64' (v20150430.0.0) with provider 'virtualbox'...
Removing box 'ubuntu/trusty64' (v20150427.0.0) with provider 'virtualbox'...
```
2015-11-09 09:32:18 +00:00
Dmitry Moskalchuk
26e3994319 Add option to enable trusted HTTP redirects 2015-05-31 09:34:02 -07:00
Seth Vargo
2e4f854725 Vagrant Cloud -> Atlas 2014-12-08 17:42:29 -08:00
Ray Ruvinskiy
5a7e00c5b1 Add HTTPS download options to box update and box outdated
Vagrant::Box.load_metadata did not provide a way to specify the HTTPS
download options that could be specified when downloading boxes
(ca cert, ca path, client cert, insecure). As a result, while it was
possible to add a box whose metadata file needed to be downloaded with one of
those options specified, it was impossible to check for updates. The following
changes have been made to address the situation:

1. Create a DownloadMixins module to provide the --insecure, --cacert, --capth,
   and --cert command line options to all of `vagrant box add`,
   `vagrant box update`, and `vagrant box outdated`.
2. Extend `Vagrant::Box.has_update?` and `Vagrant::Box.load_metadata` to accept
   said download options.
3. Extend `box outdated` and `box update` commands to pass download options
   down.
4. Extend `Vagrant::Builtin::Action::BoxCheckOutdated` to honour download
   options.
5. Options specified on the command line take precedence over options specified
   in the machine configuration, if any.
6. Fix bug in `vagrant box add` where client cert was being passed down using
   the wrong environment key.
7. Unit test coverage in update_test and box_check_outdated_test.

Resolves #4420
2014-09-07 23:57:34 -04:00
Mitchell Hashimoto
e5a7bfebbc commands/box/update: proper provider is updated [GH-4374] 2014-08-29 12:05:44 -07:00
Mitchell Hashimoto
059243670f commands/box: update gives nice message if no box 2014-08-29 11:19:54 -07:00
Mitchell Hashimoto
f99b2bac5d comamnds/box/add: change help text 2014-05-25 12:54:48 -07:00
Adam Spiers
a87cfbeea2 make box add --help text more accurate
Fixes #3898.
2014-05-24 20:37:47 +01:00
Mitchell Hashimoto
ac7012279c commands/box/add: clarify help text 2014-05-24 11:24:25 -07:00
Kalman Hazins
bb052366f7 Change symbols inside hashes to 1.9 JSON-like syntax 2014-05-22 12:35:12 -04:00
Rémi Paulmier
00a2670406 added capath option to curl Downloader 2014-05-19 18:08:23 +02:00
Mitchell Hashimoto
5da77dee5c commands/box/remove: add --force flag 2014-04-23 06:16:51 -07:00
Mitchell Hashimoto
ae8be9356e commands/box/update: show current version [GH-3467] 2014-04-14 18:55:22 -07:00
Mitchell Hashimoto
00962c7c2a commands/box/repackage: better error if box not found 2014-04-12 18:00:33 -07:00
Mitchell Hashimoto
adca39b471 commands/box/repackage: works with new stuff [GH-3372] 2014-04-12 17:57:51 -07:00