Module: Bcome::Orchestrator::Registry

Included in:
Stack::Base
Defined in:
lib/orchestrator/registry.rb

Constant Summary collapse

CONFIGS_PATH =
"bcome/config/orchestration"

Instance Method Summary collapse

Instance Method Details

#config_for_registryObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/orchestrator/registry.rb', line 10

def config_for_registry
  return [] unless has_registry_config?

  matching_keys = []
  recipe_registry.keys.each {|registry_key|
    matching_keys << registry_key if /^#{registry_key}$/.match(context_breadcrumb)
  }

  return matching_keys.collect{|registry_key| recipe_registry[registry_key] }.flatten
end

#do_load_recipesObject



5
6
7
8
# File 'lib/orchestrator/registry.rb', line 5

def do_load_recipes
  return [] unless config_for_registry.any?
  ::Bcome::Orchestrator::Loader.new(machines, config_for_registry).recipes
end

#has_registry_config?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/orchestrator/registry.rb', line 33

def has_registry_config?
  File.exist?(registry_configs_path)
end

#load_recipe_registryObject



25
26
27
# File 'lib/orchestrator/registry.rb', line 25

def load_recipe_registry
  return YAML.load_file(registry_configs_path)
end

#recipe_registryObject



21
22
23
# File 'lib/orchestrator/registry.rb', line 21

def recipe_registry
  load_recipe_registry
end

#registry_configs_pathObject



29
30
31
# File 'lib/orchestrator/registry.rb', line 29

def registry_configs_path
  "#{CONFIGS_PATH}/registry.yml"
end