Removed some delegated methods on VM to explicitly use `vm` attribute in actions so its more runner-agnostic.
This commit is contained in:
parent
26f9eca141
commit
e4548508f2
|
@ -24,7 +24,7 @@ module Vagrant
|
||||||
|
|
||||||
def export
|
def export
|
||||||
logger.info "Exporting VM to #{ovf_path} ..."
|
logger.info "Exporting VM to #{ovf_path} ..."
|
||||||
@runner.export(ovf_path)
|
@runner.vm.export(ovf_path, {}, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,7 +19,7 @@ error
|
||||||
|
|
||||||
# TODO won't work if the first disk is not the boot disk or even if there are multiple disks
|
# TODO won't work if the first disk is not the boot disk or even if there are multiple disks
|
||||||
def find_hard_drive
|
def find_hard_drive
|
||||||
@runner.storage_controllers.each do |sc|
|
@runner.vm.storage_controllers.each do |sc|
|
||||||
sc.devices.each do |d|
|
sc.devices.each do |d|
|
||||||
return d if d.image.is_a?(VirtualBox::HardDrive)
|
return d if d.image.is_a?(VirtualBox::HardDrive)
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,9 +42,5 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
def powered_off?; @vm.powered_off? end
|
def powered_off?; @vm.powered_off? end
|
||||||
|
|
||||||
def export(filename); @vm.export(filename, {}, true) end
|
|
||||||
|
|
||||||
def storage_controllers; @vm.storage_controllers end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ExportActionTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
should "call export on the runner with the ovf path" do
|
should "call export on the runner with the ovf path" do
|
||||||
@runner.expects(:export).with(@ovf_path).once
|
@vm.expects(:export).with(@ovf_path, {}, true).once
|
||||||
@action.export
|
@action.export
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,7 +21,7 @@ class MoveHardDriveActionTest < Test::Unit::TestCase
|
||||||
controller = mock('controller')
|
controller = mock('controller')
|
||||||
controller.expects(:devices).returns([hd, dvd])
|
controller.expects(:devices).returns([hd, dvd])
|
||||||
|
|
||||||
@mock_vm.expects(:storage_controllers).once.returns([controller])
|
@vm.expects(:storage_controllers).once.returns([controller])
|
||||||
assert_equal @action.find_hard_drive, hd
|
assert_equal @action.find_hard_drive, hd
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue