core: better messaging around box add not existing [GH-4414]

This commit is contained in:
Mitchell Hashimoto 2014-08-29 13:17:40 -07:00
parent 4138179207
commit 8cd2e58194
2 changed files with 8 additions and 7 deletions

View File

@ -197,17 +197,17 @@ module Vagrant
metadata_version = metadata.version( metadata_version = metadata.version(
version || ">= 0", provider: provider) version || ">= 0", provider: provider)
if !metadata_version 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, raise Errors::BoxAddNoMatchingVersion,
constraints: version || ">= 0", constraints: version || ">= 0",
name: metadata.name, name: metadata.name,
url: url, url: url,
versions: metadata.versions.join(", ") versions: metadata.versions.join(", ")
else
raise Errors::BoxAddNoMatchingProvider,
name: metadata.name,
requested: provider,
url: url
end end
end end

View File

@ -351,7 +351,8 @@ en:
box_add_no_matching_version: |- box_add_no_matching_version: |-
The box you're attempting to add has no available version that The box you're attempting to add has no available version that
matches the constraints you requested. Please double-check your 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} Box: %{name}
Address: %{url} Address: %{url}