Begin working on the #guest method for Machine instances
This commit is contained in:
parent
7efee573b8
commit
28f341ec75
|
@ -226,6 +226,10 @@ module Vagrant
|
||||||
error_key(:port_collision_resume)
|
error_key(:port_collision_resume)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class MachineGuestNotReady < VagrantError
|
||||||
|
error_key(:machine_guest_not_ready)
|
||||||
|
end
|
||||||
|
|
||||||
class MultiVMEnvironmentRequired < VagrantError
|
class MultiVMEnvironmentRequired < VagrantError
|
||||||
status_code(5)
|
status_code(5)
|
||||||
error_key(:multi_vm_required)
|
error_key(:multi_vm_required)
|
||||||
|
|
|
@ -123,6 +123,16 @@ module Vagrant
|
||||||
@communicator
|
@communicator
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns a guest implementation for this machine. The guest implementation
|
||||||
|
# knows how to do guest-OS specific tasks, such as configuring networks,
|
||||||
|
# mounting folders, etc.
|
||||||
|
#
|
||||||
|
# @return [Object]
|
||||||
|
def guest
|
||||||
|
raise Errors::MachineGuestNotReady if !communicator.ready?
|
||||||
|
# XXX: Todo
|
||||||
|
end
|
||||||
|
|
||||||
# This sets the unique ID associated with this machine. This will
|
# This sets the unique ID associated with this machine. This will
|
||||||
# persist this ID so that in the future Vagrant will be able to find
|
# persist this ID so that in the future Vagrant will be able to find
|
||||||
# this machine again. The unique ID must be absolutely unique to the
|
# this machine again. The unique ID must be absolutely unique to the
|
||||||
|
|
|
@ -85,6 +85,10 @@ en:
|
||||||
You specified: %{home_path}
|
You specified: %{home_path}
|
||||||
interrupted: |-
|
interrupted: |-
|
||||||
Vagrant exited after cleanup due to external interrupt.
|
Vagrant exited after cleanup due to external interrupt.
|
||||||
|
machine_guest_not_ready: |-
|
||||||
|
Guest-specific operations were attempted on a machine that is not
|
||||||
|
ready for guest communication. This should not happen and a bug
|
||||||
|
should be reported.
|
||||||
multi_vm_required: |-
|
multi_vm_required: |-
|
||||||
A multi-vm environment is required for name specification to this command.
|
A multi-vm environment is required for name specification to this command.
|
||||||
multi_vm_target_required: |-
|
multi_vm_target_required: |-
|
||||||
|
|
|
@ -191,6 +191,25 @@ describe Vagrant::Machine do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "guest implementation" do
|
||||||
|
let(:communicator) do
|
||||||
|
result = double("communicator")
|
||||||
|
result.stub(:ready?).and_return(true)
|
||||||
|
result
|
||||||
|
end
|
||||||
|
|
||||||
|
before(:each) do
|
||||||
|
instance.stub(:communicator).and_return(communicator)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should raise an exception if communication is not ready" do
|
||||||
|
communicator.should_receive(:ready?).and_return(false)
|
||||||
|
|
||||||
|
expect { instance.guest }.
|
||||||
|
to raise_error(Vagrant::Errors::MachineGuestNotReady)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "setting the ID" do
|
describe "setting the ID" do
|
||||||
it "should not have an ID by default" do
|
it "should not have an ID by default" do
|
||||||
instance.id.should be_nil
|
instance.id.should be_nil
|
||||||
|
|
Loading…
Reference in New Issue