Class: VagrantPlugins::Skytap::Connection::Execution

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

Overview

An Execution implements a strategy for establishing a connection to the guest VM using a given resource. A resource may have more than one strategy, depending on the initial state of the connection. (When the guest VM is first created, no connection will exist.)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Execution

Returns a new instance of Execution.



81
82
83
# File 'lib/vagrant-skytap/connection.rb', line 81

def initialize(*args)
  @env, @iface, _ = args
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



79
80
81
# File 'lib/vagrant-skytap/connection.rb', line 79

def env
  @env
end

#ifaceObject (readonly)

Returns the value of attribute iface.



79
80
81
# File 'lib/vagrant-skytap/connection.rb', line 79

def iface
  @iface
end

Instance Method Details

#executeObject

Performs the API calls which establish the connection for communicating with the guest VM. If the connection is already established, as in the case of a guest VM which already exists, this may be a no-op.

Raises:

  • (NotImplementedError)


101
102
103
# File 'lib/vagrant-skytap/connection.rb', line 101

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

#make(*args) ⇒ Connection::Execution

Creates an execution object which will perform the correct actions to establish a connection via a specific connectable resource. This method should be overridden to return an object of the correct execution subclass given the resource’s initial state. For example, if the guest’s network is already attached to this VPN, but disconnected, this method would return a ConnectAndUseExecution.

Returns:

Raises:

  • (NotImplementedError)


93
94
95
# File 'lib/vagrant-skytap/connection.rb', line 93

def make(*args)
  raise NotImplementedError.new('Must override')
end

#messageString

The description of the actions to be taken when this choice is executed, e.g. “Connect to and use VPN 1”.

Returns:



117
118
119
# File 'lib/vagrant-skytap/connection.rb', line 117

def message
  verb
end

#verbString

The name of the action(s) performed by this execution subclass, e.g. “Connect and use”.

Returns:

Raises:

  • (NotImplementedError)


109
110
111
# File 'lib/vagrant-skytap/connection.rb', line 109

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