Class: VagrantPlugins::Skytap::Connection::PublicIpChoice::PublicIpAttachmentExecution

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

Direct Known Subclasses

AttachAndUseExecution, UseExecution

Instance Attribute Summary collapse

Attributes inherited from Execution

#env, #iface

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Execution

#execute, #make, #verb

Constructor Details

#initialize(env, iface, ip) ⇒ PublicIpAttachmentExecution

Returns a new instance of PublicIpAttachmentExecution.



56
57
58
59
# File 'lib/vagrant-skytap/connection/public_ip_choice.rb', line 56

def initialize(env, iface, ip)
  super
  @ip = ip
end

Instance Attribute Details

#ipObject (readonly)

Returns the value of attribute ip.



46
47
48
# File 'lib/vagrant-skytap/connection/public_ip_choice.rb', line 46

def ip
  @ip
end

Class Method Details

.make(env, iface, ip) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/vagrant-skytap/connection/public_ip_choice.rb', line 48

def self.make(env, iface, ip)
  if ip.attached?
    UseExecution.new(env, iface, ip)
  else
    AttachAndUseExecution.new(env, iface, ip)
  end
end

Instance Method Details

#messageObject



61
62
63
64
65
66
67
68
69
# File 'lib/vagrant-skytap/connection/public_ip_choice.rb', line 61

def message
  "#{verb}: #{ip.address}".tap do |ret|
    if ip.deployed?
      ret << " " << I18n.t("vagrant_skytap.connections.public_ip.deployed")
    elsif ip.attached?
      ret << " " << I18n.t("vagrant_skytap.connections.public_ip.attached")
    end
  end
end