Use pristine version string when constructing path to box
Without this change, the version string may be mutated when passed through Gem::Version.new(version).to_s before being used to construct the box directory. This is a problem when using prerelease version numbers because, for example, it will look for "~/.vagrant.d/boxes/1.0.0.pre.alpha.1" when it should be looking for "~/.vagrant.d/boxes/1.0.0-alpha.1".
This commit is contained in:
parent
2faa510120
commit
1378eebea9
|
@ -276,17 +276,16 @@ module Vagrant
|
|||
next if versiondir.basename.to_s.start_with?(".")
|
||||
|
||||
version = versiondir.basename.to_s
|
||||
Gem::Version.new(version)
|
||||
end.compact
|
||||
|
||||
# Traverse through versions with the latest version first
|
||||
versions.sort.reverse.each do |v|
|
||||
if !requirements.all? { |r| r.satisfied_by?(v) }
|
||||
if !requirements.all? { |r| r.satisfied_by?(Gem::Version.new(v)) }
|
||||
# Unsatisfied version requirements
|
||||
next
|
||||
end
|
||||
|
||||
versiondir = box_directory.join(v.to_s)
|
||||
versiondir = box_directory.join(v)
|
||||
providers.each do |provider|
|
||||
provider_dir = versiondir.join(provider.to_s)
|
||||
next if !provider_dir.directory?
|
||||
|
@ -303,7 +302,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
return Box.new(
|
||||
name, provider, v.to_s, provider_dir,
|
||||
name, provider, v, provider_dir,
|
||||
metadata_url: metadata_url,
|
||||
)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue