Class: Wakame::MasterManagers::ClusterManager::ClusterConfigLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/wakame/master_managers/cluster_manager.rb

Instance Method Summary collapse

Instance Method Details

#load(cluster_rb_path = Wakame.config.cluster_config_path) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/wakame/master_managers/cluster_manager.rb', line 8

def load(cluster_rb_path=Wakame.config.cluster_config_path)
  Wakame.log.info("#{self.class}: Loading cluster.rb: #{cluster_rb_path}")
  @loaded_cluster_names = {}

  eval(File.readlines(cluster_rb_path).join(''), binding)

  # Clear uninitialized cluster data in the store.
  Service::ServiceCluster.find_all.each { |cluster|
    cluster.delete unless @loaded_cluster_names.has_key?(cluster.name)
  }

  @loaded_cluster_names
end