Class: VagrantPlugins::Skytap::Connection::Choice

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-skytap/connection.rb

Overview

A Choice represents the potential for establishing a connection to the guest VM via a specific resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Choice

Thia method should be overridden to call #make on the

Connection::Execution

subclass for this particular resource type.

The execution holds all the information needed to establish the connection.



44
45
46
# File 'lib/vagrant-skytap/connection.rb', line 44

def initialize(*args)
  @env = args.first
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



38
39
40
# File 'lib/vagrant-skytap/connection.rb', line 38

def env
  @env
end

#executionObject (readonly)

Returns the value of attribute execution.



38
39
40
# File 'lib/vagrant-skytap/connection.rb', line 38

def execution
  @execution
end

#ifaceObject (readonly)

Returns the value of attribute iface.



38
39
40
# File 'lib/vagrant-skytap/connection.rb', line 38

def iface
  @iface
end

#validation_error_messageObject (readonly)

Returns the value of attribute validation_error_message.



38
39
40
# File 'lib/vagrant-skytap/connection.rb', line 38

def validation_error_message
  @validation_error_message
end

Instance Method Details

#chooseArray

Invokes the execution, and determines the IP address and port for communicating with the guest VM.

Returns:

  • (Array)

    Tuple of [String], [Integer] The IP address and port for communicating with the guest VM.

Raises:

  • (NotImplementedError)


53
54
55
# File 'lib/vagrant-skytap/connection.rb', line 53

def choose
  raise NotImplementedError.new('Must override')
end

#to_sObject



69
70
71
# File 'lib/vagrant-skytap/connection.rb', line 69

def to_s
  execution.message
end

#valid?Boolean

Override this method to add any validation logic needed by a specific resource type. For example, [Connection::TunnelChoice] must check for subnet overlaps. If this method returns false, this particular choice should not be offered to the user. For some resource types, it may be useful to set @validation_error_message on this choice when returning false.

Returns:

  • (Boolean)


65
66
67
# File 'lib/vagrant-skytap/connection.rb', line 65

def valid?
  true
end