(#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.
This commit is contained in:
Brian Cain 2018-01-08 09:41:12 -08:00
parent 4eefd94a28
commit 11ddd0136d
No known key found for this signature in database
GPG Key ID: 43D51080D357A001
3 changed files with 14 additions and 13 deletions

View File

@ -69,6 +69,7 @@ module Vagrant
env[:ui].warn(I18n.t( env[:ui].warn(I18n.t(
"vagrant.box_outdated_single", "vagrant.box_outdated_single",
name: update[0].name, name: update[0].name,
provider: box.provider,
current: box.version, current: box.version,
latest: update[1].version)) latest: update[1].version))
else else

View File

@ -51,15 +51,12 @@ module VagrantPlugins
def outdated_global(download_options) def outdated_global(download_options)
boxes = {} boxes = {}
@env.boxes.all.reverse.each do |name, version, provider| @env.boxes.all.reverse.each do |name, version, provider|
next if boxes[name] box = @env.boxes.find(name, provider, version)
boxes[name] = @env.boxes.find(name, provider, version)
end
boxes.values.each do |box|
if !box.metadata_url if !box.metadata_url
@env.ui.output(I18n.t( @env.ui.output(I18n.t(
"vagrant.box_outdated_no_metadata", "vagrant.box_outdated_no_metadata",
name: box.name)) name: box.name,
provider: box.provider))
next next
end end
@ -70,6 +67,7 @@ module VagrantPlugins
@env.ui.error(I18n.t( @env.ui.error(I18n.t(
"vagrant.box_outdated_metadata_error", "vagrant.box_outdated_metadata_error",
name: box.name, name: box.name,
provider: box.provider,
message: e.extra_data[:message])) message: e.extra_data[:message]))
next next
end end
@ -80,11 +78,13 @@ module VagrantPlugins
@env.ui.success(I18n.t( @env.ui.success(I18n.t(
"vagrant.box_up_to_date", "vagrant.box_up_to_date",
name: box.name, name: box.name,
provider: box.provider,
version: box.version)) version: box.version))
else else
@env.ui.warn(I18n.t( @env.ui.warn(I18n.t(
"vagrant.box_outdated", "vagrant.box_outdated",
name: box.name, name: box.name,
provider: box.provider,
current: box.version, current: box.version,
latest: latest.to_s,)) latest: latest.to_s,))
end end

View File

@ -36,7 +36,7 @@ en:
box_loading_metadata: |- box_loading_metadata: |-
Loading metadata for box '%{name}' Loading metadata for box '%{name}'
box_outdated: |- box_outdated: |-
* '%{name}' is outdated! Current: %{current}. Latest: %{latest} * '%{name}' for '%{provider}' is outdated! Current: %{current}. Latest: %{latest}
box_outdated_checking_with_refresh: |- box_outdated_checking_with_refresh: |-
Checking if box '%{name}' is up to date... Checking if box '%{name}' is up to date...
box_outdated_local: |- box_outdated_local: |-
@ -58,20 +58,20 @@ en:
Error loading box metadata while attempting to check for Error loading box metadata while attempting to check for
updates: %{message} updates: %{message}
box_outdated_single: |- box_outdated_single: |-
A newer version of the box '%{name}' is available! You currently A newer version of the box '%{name}' for provider '%{provider}' is
have version '%{current}'. The latest is version '%{latest}'. Run available! You currently have version '%{current}'. The latest is version
`vagrant box update` to update. '%{latest}'. Run `vagrant box update` to update.
box_outdated_metadata_error: |- box_outdated_metadata_error: |-
* '%{name}': Error loading metadata: %{message} * '%{name}' for '%{provider}': Error loading metadata: %{message}
box_outdated_no_metadata: |- box_outdated_no_metadata: |-
* '%{name}' wasn't added from a catalog, no version information * '%{name}' for '%{provider}' wasn't added from a catalog, no version information
box_updating: |- box_updating: |-
Updating '%{name}' with provider '%{provider}' from version Updating '%{name}' with provider '%{provider}' from version
'%{old}' to '%{new}'... '%{old}' to '%{new}'...
box_update_checking: |- box_update_checking: |-
Checking for updates to '%{name}' Checking for updates to '%{name}'
box_up_to_date: |- box_up_to_date: |-
* '%{name}' (v%{version}) is up to date * '%{name}' for '%{provider}' (v%{version}) is up to date
box_up_to_date_single: |- box_up_to_date_single: |-
Box '%{name}' (v%{version}) is running the latest version. Box '%{name}' (v%{version}) is running the latest version.
cfengine_bootstrapping: |- cfengine_bootstrapping: |-