Only grab provider_config if provider key exists and config isn't empty
This commit is contained in:
parent
1579ac9c3a
commit
13c91d68a6
@ -143,8 +143,11 @@ module VagrantPlugins
|
||||
def self.create_disk(machine, disk_config)
|
||||
machine.ui.detail(I18n.t("vagrant.cap.configure_disks.create_disk", name: disk_config.name))
|
||||
disk_provider_config = {}
|
||||
disk_provider_config = disk_config.provider_config[:hyperv] if disk_config.provider_config
|
||||
# Convert any shortcut options for powershell commands
|
||||
|
||||
if disk_config.provider_config && disk_config.provider_config.key?(:hyperv)
|
||||
disk_provider_config = disk_config.provider_config[:hyperv]
|
||||
end
|
||||
|
||||
if !disk_provider_config.empty?
|
||||
disk_provider_config = convert_size_vars!(disk_provider_config)
|
||||
end
|
||||
|
||||
@ -207,10 +207,10 @@ describe VagrantPlugins::HyperV::Cap::ConfigureDisks do
|
||||
|
||||
it "creates a disk and attaches it to a guest" do
|
||||
expect(machine).to receive(:data_dir).and_return(data_dir)
|
||||
expect(driver).to receive(:create_disk).with(disk_file, disk_config.size, nil)
|
||||
expect(driver).to receive(:create_disk).with(disk_file, disk_config.size, {})
|
||||
expect(driver).to receive(:get_disk).with(disk_file).and_return(disk)
|
||||
|
||||
expect(driver).to receive(:attach_disk).with(disk_file, nil)
|
||||
expect(driver).to receive(:attach_disk).with(disk_file, {})
|
||||
|
||||
subject.create_disk(machine, disk_config)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user