Class: VagrantPlugins::Skytap::Connection::PublishedServiceChoice

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

Defined Under Namespace

Classes: CreateAndUseExecution, PublishedServiceExecution, UseExecution

Instance Attribute Summary collapse

Attributes inherited from Choice

#env, #execution, #iface, #validation_error_message

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Choice

#to_s

Constructor Details

#initialize(env, iface, service = nil) ⇒ PublishedServiceChoice

Returns a new instance of PublishedServiceChoice.



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

def initialize(env, iface, service=nil)
  @env = env
  @iface = iface
  @service = service
  @execution = PublishedServiceExecution.make(env, iface, service)
end

Instance Attribute Details

#serviceObject (readonly)

Returns the value of attribute service.



29
30
31
# File 'lib/vagrant-skytap/connection/published_service_choice.rb', line 29

def service
  @service
end

Class Method Details

.uncreated_choice(env, iface) ⇒ Object



31
32
33
# File 'lib/vagrant-skytap/connection/published_service_choice.rb', line 31

def self.uncreated_choice(env, iface)
  new(env, iface, nil)
end

Instance Method Details

#chooseObject



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

def choose
  execution.execute
  @service = execution.service
  [service.external_ip, service.external_port]
end

#valid?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/vagrant-skytap/connection/published_service_choice.rb', line 48

def valid?
  service.nil? || service.internal_port == DEFAULT_PORT
end