Class: BarkingIguana::Compound::Host

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Comparable
Defined in:
lib/barking_iguana/compound/host.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, ip_address:) ⇒ Host

Returns a new instance of Host.



8
9
10
11
12
# File 'lib/barking_iguana/compound/host.rb', line 8

def initialize(name:, ip_address:)
  self.inventory_name = name
  self.ip_address = ip_address
  self.state = 'unknown'
end

Instance Attribute Details

#inventory_nameObject

Returns the value of attribute inventory_name.



6
7
8
# File 'lib/barking_iguana/compound/host.rb', line 6

def inventory_name
  @inventory_name
end

#ip_addressObject

Returns the value of attribute ip_address.



6
7
8
# File 'lib/barking_iguana/compound/host.rb', line 6

def ip_address
  @ip_address
end

#stateObject

Returns the value of attribute state.



6
7
8
# File 'lib/barking_iguana/compound/host.rb', line 6

def state
  @state
end

Instance Method Details

#<=>(other) ⇒ Object



18
19
20
# File 'lib/barking_iguana/compound/host.rb', line 18

def <=> other
  name <=> other.name
end

#assign_ip_address(new_ip_address) ⇒ Object



23
24
25
# File 'lib/barking_iguana/compound/host.rb', line 23

def assign_ip_address new_ip_address
  self.ip_address = new_ip_address
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/barking_iguana/compound/host.rb', line 41

def eql? other
  inventory_name == other.inventory_name
end

#nameObject



14
15
16
# File 'lib/barking_iguana/compound/host.rb', line 14

def name
  @name ||= inventory_name.gsub(/[^a-z0-9\-]/, '-')
end

#ssh_extra_argsObject



35
36
37
# File 'lib/barking_iguana/compound/host.rb', line 35

def ssh_extra_args
  '-o StrictHostKeyChecking=no'
end

#ssh_keyObject



27
28
29
# File 'lib/barking_iguana/compound/host.rb', line 27

def ssh_key
  "#{ENV['HOME']}/.vagrant.d/insecure_private_key"
end

#ssh_usernameObject



31
32
33
# File 'lib/barking_iguana/compound/host.rb', line 31

def ssh_username
  'vagrant'
end