DVD attachments should never be primary
This commit is contained in:
parent
4480eb0d88
commit
e21fb59380
@ -180,6 +180,10 @@ module VagrantPlugins
|
|||||||
errors << I18n.t("vagrant.config.disk.dvd_type_file_required", name: @name, machine: machine.name)
|
errors << I18n.t("vagrant.config.disk.dvd_type_file_required", name: @name, machine: machine.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @type == :dvd && @primary
|
||||||
|
errors << I18n.t("vagrant.config.disk.dvd_type_primary", name: @name, machine: machine.name)
|
||||||
|
end
|
||||||
|
|
||||||
if @file
|
if @file
|
||||||
if !@file.is_a?(String)
|
if !@file.is_a?(String)
|
||||||
errors << I18n.t("vagrant.config.disk.invalid_file_type", file: @file, machine: machine.name)
|
errors << I18n.t("vagrant.config.disk.invalid_file_type", file: @file, machine: machine.name)
|
||||||
|
|||||||
@ -1846,6 +1846,9 @@ en:
|
|||||||
disk:
|
disk:
|
||||||
dvd_type_file_required:
|
dvd_type_file_required:
|
||||||
A 'file' option is required when defining a disk of type `:dvd` for guest '%{machine}'.
|
A 'file' option is required when defining a disk of type `:dvd` for guest '%{machine}'.
|
||||||
|
dvd_type_primary: |-
|
||||||
|
Disks of type ':dvd' cannot be defined as a primary disks. Please
|
||||||
|
remove the 'primary' argument for disk '%{name}' on guest '%{machine}'.
|
||||||
invalid_ext: |-
|
invalid_ext: |-
|
||||||
Disk type '%{ext}' is not a valid disk extention for '%{name}'. Please pick one of the following supported disk types: %{exts}
|
Disk type '%{ext}' is not a valid disk extention for '%{name}'. Please pick one of the following supported disk types: %{exts}
|
||||||
invalid_type: |-
|
invalid_type: |-
|
||||||
|
|||||||
@ -85,18 +85,24 @@ describe VagrantPlugins::Kernel_V2::VagrantConfigDisk do
|
|||||||
before do
|
before do
|
||||||
subject.type = :dvd
|
subject.type = :dvd
|
||||||
subject.name = "untitled"
|
subject.name = "untitled"
|
||||||
end
|
|
||||||
|
|
||||||
it "is valid with file path set" do
|
|
||||||
allow(File).to receive(:file?).with(iso_path).and_return(true)
|
allow(File).to receive(:file?).with(iso_path).and_return(true)
|
||||||
subject.file = iso_path
|
subject.file = iso_path
|
||||||
|
end
|
||||||
|
|
||||||
|
it "is valid with test defaults" do
|
||||||
subject.finalize!
|
subject.finalize!
|
||||||
assert_valid
|
assert_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is invalid if file path is unset" do
|
it "is invalid if file path is unset" do
|
||||||
|
subject.file = nil
|
||||||
|
subject.finalize!
|
||||||
|
assert_invalid
|
||||||
|
end
|
||||||
|
|
||||||
|
it "is invalid if primary" do
|
||||||
|
subject.primary = true
|
||||||
subject.finalize!
|
subject.finalize!
|
||||||
errors = subject.validate(machine)
|
|
||||||
assert_invalid
|
assert_invalid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user