Class: ClusterManagement::Cluster

Inherits:
Object
  • Object
show all
Defined in:
lib/cluster_management/cluster.rb

Defined Under Namespace

Classes: Services

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCluster

Returns a new instance of Cluster.



24
25
26
27
28
29
30
31
32
# File 'lib/cluster_management/cluster.rb', line 24

def initialize 
  @services = Services.new
      
  @boxes = Hash.new do |h, host|
    box = config.ssh ? Box.new(host.to_s, config.ssh) : Box.new(host.to_s)  
    box.open
    h[host] = box
  end
end

Instance Attribute Details

#boxesObject (readonly)

Returns the value of attribute boxes.



34
35
36
# File 'lib/cluster_management/cluster.rb', line 34

def boxes
  @boxes
end

#configObject



41
# File 'lib/cluster_management/cluster.rb', line 41

def config; @config || raise("config not defined!") end

#loggerObject



42
# File 'lib/cluster_management/cluster.rb', line 42

def logger; @logger || raise("logger not defined!") end

Instance Method Details

#services(&b) ⇒ Object



36
37
38
# File 'lib/cluster_management/cluster.rb', line 36

def services &b
  b ? @services.instance_eval(&b) : @services
end