From 11ddd0136d82c8b89bc3b942a78c535843d0b848 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Mon, 8 Jan 2018 09:41:12 -0800 Subject: [PATCH] (#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. --- lib/vagrant/action/builtin/box_check_outdated.rb | 1 + plugins/commands/box/command/outdated.rb | 12 ++++++------ templates/locales/en.yml | 14 +++++++------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/vagrant/action/builtin/box_check_outdated.rb b/lib/vagrant/action/builtin/box_check_outdated.rb index d39afd272..afb8b7368 100644 --- a/lib/vagrant/action/builtin/box_check_outdated.rb +++ b/lib/vagrant/action/builtin/box_check_outdated.rb @@ -69,6 +69,7 @@ module Vagrant env[:ui].warn(I18n.t( "vagrant.box_outdated_single", name: update[0].name, + provider: box.provider, current: box.version, latest: update[1].version)) else diff --git a/plugins/commands/box/command/outdated.rb b/plugins/commands/box/command/outdated.rb index 4fd6e5cf3..f7bbdfee1 100644 --- a/plugins/commands/box/command/outdated.rb +++ b/plugins/commands/box/command/outdated.rb @@ -51,15 +51,12 @@ module VagrantPlugins def outdated_global(download_options) boxes = {} @env.boxes.all.reverse.each do |name, version, provider| - next if boxes[name] - boxes[name] = @env.boxes.find(name, provider, version) - end - - boxes.values.each do |box| + box = @env.boxes.find(name, provider, version) if !box.metadata_url @env.ui.output(I18n.t( "vagrant.box_outdated_no_metadata", - name: box.name)) + name: box.name, + provider: box.provider)) next end @@ -70,6 +67,7 @@ module VagrantPlugins @env.ui.error(I18n.t( "vagrant.box_outdated_metadata_error", name: box.name, + provider: box.provider, message: e.extra_data[:message])) next end @@ -80,11 +78,13 @@ module VagrantPlugins @env.ui.success(I18n.t( "vagrant.box_up_to_date", name: box.name, + provider: box.provider, version: box.version)) else @env.ui.warn(I18n.t( "vagrant.box_outdated", name: box.name, + provider: box.provider, current: box.version, latest: latest.to_s,)) end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 38ec6c32e..d8a6986c0 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -36,7 +36,7 @@ en: box_loading_metadata: |- Loading metadata for box '%{name}' box_outdated: |- - * '%{name}' is outdated! Current: %{current}. Latest: %{latest} + * '%{name}' for '%{provider}' is outdated! Current: %{current}. Latest: %{latest} box_outdated_checking_with_refresh: |- Checking if box '%{name}' is up to date... box_outdated_local: |- @@ -58,20 +58,20 @@ en: Error loading box metadata while attempting to check for updates: %{message} box_outdated_single: |- - A newer version of the box '%{name}' is available! You currently - have version '%{current}'. The latest is version '%{latest}'. Run - `vagrant box update` to update. + A newer version of the box '%{name}' for provider '%{provider}' is + available! You currently have version '%{current}'. The latest is version + '%{latest}'. Run `vagrant box update` to update. box_outdated_metadata_error: |- - * '%{name}': Error loading metadata: %{message} + * '%{name}' for '%{provider}': Error loading metadata: %{message} 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: |- Updating '%{name}' with provider '%{provider}' from version '%{old}' to '%{new}'... box_update_checking: |- Checking for updates to '%{name}' 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 '%{name}' (v%{version}) is running the latest version. cfengine_bootstrapping: |-