Adjust installation for unknown default architecture
When the reported architecture is unknown and the provider is listed as the default architecture, add the box without architecture information so it is installed without architecture information on the path within the collection.
This commit is contained in:
parent
e719113165
commit
74b4a2b1f5
@ -329,6 +329,17 @@ module Vagrant
|
||||
provider_url = authed_urls[0]
|
||||
end
|
||||
|
||||
# The architecture name used when adding the box should be
|
||||
# the value extracted from the metadata provider
|
||||
arch_name = metadata_provider.architecture
|
||||
|
||||
# In the special case where the architecture name is "unknown" and
|
||||
# it is listed as the default architecture, unset the architecture
|
||||
# name so it is installed without architecture information
|
||||
if arch_name == "unknown" && metadata_provider.default_architecture
|
||||
arch_name = nil
|
||||
end
|
||||
|
||||
box_add(
|
||||
[[provider_url, metadata_provider.url]],
|
||||
metadata.name,
|
||||
@ -338,7 +349,7 @@ module Vagrant
|
||||
env,
|
||||
checksum: metadata_provider.checksum,
|
||||
checksum_type: metadata_provider.checksum_type,
|
||||
architecture: metadata_provider.architecture,
|
||||
architecture: arch_name,
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@ -1033,7 +1033,7 @@ describe Vagrant::Action::Builtin::BoxAdd, :skip_windows, :bsdtar do
|
||||
subject.call(env)
|
||||
end
|
||||
|
||||
it "adds the latest version of a box with only one provider and no unknown architecture set as default" do
|
||||
it "adds the latest version of a box with only one provider and unknown architecture set as default" do
|
||||
box_path = iso_env.box2_file(:virtualbox)
|
||||
tf = Tempfile.new(["vagrant-box-latest-version", ".json"]).tap do |f|
|
||||
f.write(
|
||||
@ -1072,7 +1072,7 @@ describe Vagrant::Action::Builtin::BoxAdd, :skip_windows, :bsdtar do
|
||||
expect(name).to eq("foo/bar")
|
||||
expect(version).to eq("0.7")
|
||||
expect(opts[:metadata_url]).to eq("file://#{tf.path}")
|
||||
expect(opts[:architecture]).to eq("unknown")
|
||||
expect(opts[:architecture]).to be_nil
|
||||
true
|
||||
}.and_return(box)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user