From 8cd2e581946e2a02a5dae0e22c24166c99fb8b4d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 29 Aug 2014 13:17:40 -0700 Subject: [PATCH] core: better messaging around box add not existing [GH-4414] --- lib/vagrant/action/builtin/box_add.rb | 12 ++++++------ templates/locales/en.yml | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/vagrant/action/builtin/box_add.rb b/lib/vagrant/action/builtin/box_add.rb index 5e0655662..fb2109326 100644 --- a/lib/vagrant/action/builtin/box_add.rb +++ b/lib/vagrant/action/builtin/box_add.rb @@ -197,17 +197,17 @@ module Vagrant metadata_version = metadata.version( version || ">= 0", provider: provider) if !metadata_version - if !provider + if provider && !metadata.version(">= 0", provider: provider) + raise Errors::BoxAddNoMatchingProvider, + name: metadata.name, + requested: provider, + url: url + else raise Errors::BoxAddNoMatchingVersion, constraints: version || ">= 0", name: metadata.name, url: url, versions: metadata.versions.join(", ") - else - raise Errors::BoxAddNoMatchingProvider, - name: metadata.name, - requested: provider, - url: url end end diff --git a/templates/locales/en.yml b/templates/locales/en.yml index 36037d6c0..050fe2972 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -351,7 +351,8 @@ en: box_add_no_matching_version: |- The box you're attempting to add has no available version that matches the constraints you requested. Please double-check your - settings. + settings. Also verify that if you specified version constraints, + that the provider you wish to use is available for these constriants. Box: %{name} Address: %{url}