Class: Vagrant::Hivemind::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant/hivemind/host.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname, ip_address, options = {}) ⇒ Host

Returns a new instance of Host.



9
10
11
12
13
14
15
16
17
# File 'lib/vagrant/hivemind/host.rb', line 9

def initialize(hostname, ip_address, options = {})
  @hostname   = hostname
  @ip_address = ip_address
  @is_control = options[:is_control] || false
  @box_size   = options[:box_size]   || :small.to_s
  @box_type   = options[:box_type]   || :server.to_s
  @forwarded_ports = []
  @is_data_detached = options[:is_data_detached] || false
end

Instance Attribute Details

#box_sizeObject

Returns the value of attribute box_size.



6
7
8
# File 'lib/vagrant/hivemind/host.rb', line 6

def box_size
  @box_size
end

#box_typeObject

Returns the value of attribute box_type.



6
7
8
# File 'lib/vagrant/hivemind/host.rb', line 6

def box_type
  @box_type
end

#forwarded_portsObject

Returns the value of attribute forwarded_ports.



6
7
8
# File 'lib/vagrant/hivemind/host.rb', line 6

def forwarded_ports
  @forwarded_ports
end

#hostnameObject

Returns the value of attribute hostname.



6
7
8
# File 'lib/vagrant/hivemind/host.rb', line 6

def hostname
  @hostname
end

#ip_addressObject

Returns the value of attribute ip_address.



6
7
8
# File 'lib/vagrant/hivemind/host.rb', line 6

def ip_address
  @ip_address
end

#is_controlObject

Returns the value of attribute is_control.



6
7
8
# File 'lib/vagrant/hivemind/host.rb', line 6

def is_control
  @is_control
end

#is_data_detachedObject

Returns the value of attribute is_data_detached.



6
7
8
# File 'lib/vagrant/hivemind/host.rb', line 6

def is_data_detached
  @is_data_detached
end

Class Method Details

.controlObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant/hivemind/host.rb', line 19

def self.control
  unless @control
    @control = self.new(
      Constants::CONTROL_HOSTNAME,
      Util::Network.starting_ip_address,
      {
        is_control: true,
        box_size:   :small.to_s,
        box_type:   :server.to_s
      })
  end
  @control
end