Just always return the SSH communicator for machines for now.
In the future we'll actually find a matching communicator but for now since we're just focusing on machine abstraction, we just return SSH.
This commit is contained in:
parent
5ae3e0e80c
commit
64afd578b3
|
@ -107,9 +107,20 @@ module Vagrant
|
|||
#
|
||||
# @return [Object]
|
||||
def communicate
|
||||
# For now, we always return SSH. In the future, we'll abstract
|
||||
# this and allow plugins to define new methods of communication.
|
||||
if !@communicator
|
||||
# For now, we always return SSH. In the future, we'll abstract
|
||||
# this and allow plugins to define new methods of communication.
|
||||
Vagrant.plugin("1").registered.each do |plugin|
|
||||
klass = plugin.communicator[:ssh]
|
||||
if klass
|
||||
# This plugin has the SSH communicator, use it.
|
||||
@communicator = klass.new(self)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@communicator
|
||||
end
|
||||
|
||||
# This sets the unique ID associated with this machine. This will
|
||||
|
|
|
@ -14,8 +14,8 @@ module VagrantPlugins
|
|||
module CommunicatorSSH
|
||||
# This class provides communication with the VM via SSH.
|
||||
class Communicator < Vagrant.plugin("1", :communicator)
|
||||
include Util::ANSIEscapeCodeRemover
|
||||
include Util::Retryable
|
||||
include Vagrant::Util::ANSIEscapeCodeRemover
|
||||
include Vagrant::Util::Retryable
|
||||
|
||||
def self.match?(machine)
|
||||
# All machines are currently expected to have SSH.
|
||||
|
|
|
@ -170,6 +170,17 @@ describe Vagrant::Machine do
|
|||
end
|
||||
end
|
||||
|
||||
describe "communicator" do
|
||||
it "should always return the SSH communicator" do
|
||||
instance.communicate.should be_kind_of(VagrantPlugins::CommunicatorSSH::Communicator)
|
||||
end
|
||||
|
||||
it "should memoize the result" do
|
||||
obj = instance.communicate
|
||||
instance.communicate.should eql(obj)
|
||||
end
|
||||
end
|
||||
|
||||
describe "setting the ID" do
|
||||
it "should not have an ID by default" do
|
||||
instance.id.should be_nil
|
||||
|
|
Loading…
Reference in New Issue