Class: Nagios::HostManager

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/infrastructure/host_manager.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHostManager

Returns a new instance of HostManager.



11
12
13
# File 'lib/rspec/infrastructure/host_manager.rb', line 11

def initialize
  @hosts = {}
end

Instance Attribute Details

#hostsObject (readonly)

Returns the value of attribute hosts.



9
10
11
# File 'lib/rspec/infrastructure/host_manager.rb', line 9

def hosts
  @hosts
end

Class Method Details

.hostnames_for_roles(environment, roles) ⇒ Object



19
20
21
22
23
# File 'lib/rspec/infrastructure/host_manager.rb', line 19

def self.hostnames_for_roles environment, roles
  [ *roles ].map do |role|
    $hosts[environment][role]
  end.flatten
end

Instance Method Details

#manage(hostname) ⇒ Object



15
16
17
# File 'lib/rspec/infrastructure/host_manager.rb', line 15

def manage hostname
  @hosts[hostname] ||= Host.new(hostname)
end