Class: HybridPlatformsConductor::HpcPlugins::PlatformHandler::ServerlessChef::RecipesTreeBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb

Overview

Build the recipes tree from a ServerlessChef platform

Instance Method Summary collapse

Constructor Details

#initialize(config, platform) ⇒ RecipesTreeBuilder

Constructor

Parameters
  • config (Config): Configuration that can be used to tune tree building

  • platform (ServerlessChef): Platform for which we build the recipes tree



19
20
21
22
# File 'lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb', line 19

def initialize(config, platform)
  @config = config
  @platform = platform
end

Instance Method Details

#full_recipes_treeObject

Get the whole tree of recipes

Result
  • The tree of recipes: Hash< Symbol, Hash< Symbol, Hash<Symbol,Object> > Hash< cookbook, Hash< recipe, recipe_info > Each recipe info has the following attributes:

    • included_recipes (Array< [String or nil, Symbol, Symbol] >): List of [cookbook_dir, cookbook, recipe] included by this recipe

    • used_by_policies (Array<String>): List of policies that include (recursively) this recipe

    • used_templates (Array<String>): List of template sources used by this recipe

    • used_files (Array<String>): List of cookbook files used by this recipe

    • used_cookbooks (Array<Symbol>): List of additional used cookbooks (for example for resources)



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb', line 36

def full_recipes_tree
  @recipes_tree = {}
  @platform.deployable_services.each do |service|
    @platform.policy_run_list(service).each do |(cookbook_dir, cookbook, recipe)|
      add_recipe_in_tree(cookbook_dir, cookbook, recipe)
    end
  end
  @platform.deployable_services.each do |service|
    @platform.policy_run_list(service).each do |(cookbook_dir, cookbook, recipe)|
      mark_recipe_used_by_policy(cookbook, recipe, service)
    end
  end
  @recipes_tree
end