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}