summaryrefslogtreecommitdiff
path: root/lib/chef/policy_builder
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2019-03-11 11:49:31 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-03-11 11:49:31 -0700
commit66015ba654469f4dacfd78d40b02aafee52bbf1b (patch)
treeb00d0de111d18980f446b006ac63ef599eea8108 /lib/chef/policy_builder
parent4037976199b728d4bdc18fd428e8d40a84c97e2b (diff)
downloadchef-66015ba654469f4dacfd78d40b02aafee52bbf1b.tar.gz
Extract Action Collection from Data Collector
See the PR for details on this change. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/policy_builder')
-rw-r--r--lib/chef/policy_builder/dynamic.rb3
-rw-r--r--lib/chef/policy_builder/expand_node_object.rb17
-rw-r--r--lib/chef/policy_builder/policyfile.rb4
3 files changed, 18 insertions, 6 deletions
diff --git a/lib/chef/policy_builder/dynamic.rb b/lib/chef/policy_builder/dynamic.rb
index 8ce4f25bfa..2c49f41656 100644
--- a/lib/chef/policy_builder/dynamic.rb
+++ b/lib/chef/policy_builder/dynamic.rb
@@ -1,6 +1,6 @@
#
# Author:: Daniel DeLeo (<dan@chef.io>)
-# Copyright:: Copyright 2015-2016, Chef Software, Inc.
+# Copyright:: Copyright 2015-2019, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -74,6 +74,7 @@ class Chef
select_implementation(node)
implementation.finish_load_node(node)
node
+ events.node_load_success(node)
rescue Exception => e
events.node_load_failed(node_name, e, config)
raise
diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb
index c91c74b047..839c3bb526 100644
--- a/lib/chef/policy_builder/expand_node_object.rb
+++ b/lib/chef/policy_builder/expand_node_object.rb
@@ -3,7 +3,7 @@
# Author:: Tim Hinderliter (<tim@chef.io>)
# Author:: Christopher Walters (<cw@chef.io>)
# Author:: Daniel DeLeo (<dan@chef.io>)
-# Copyright:: Copyright 2008-2017, Chef Software Inc.
+# Copyright:: Copyright 2008-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -68,6 +68,11 @@ class Chef
Chef.set_run_context(run_context)
end
+ # This not only creates the run_context but this is where we kick off
+ # compiling the entire expanded run_list, loading all the libraries, resources,
+ # attribute files and recipes, and constructing the entire resource collection.
+ # (FIXME: break up creating the run_context and compiling the cookbooks)
+ #
def setup_run_context(specific_recipes = nil)
if Chef::Config[:solo_legacy_mode]
Chef::Cookbook::FileVendor.fetch_from_disk(Chef::Config[:cookbook_path])
@@ -88,18 +93,20 @@ class Chef
run_context = Chef::RunContext.new(node, cookbook_collection, @events)
end
- # TODO: this is really obviously not the place for this
- # FIXME: need same edits
+ # TODO: move this into the cookbook_compilation_start hook
setup_chef_class(run_context)
- # TODO: this is not the place for this. It should be in Runner or
- # CookbookCompiler or something.
+ events.cookbook_compilation_start(run_context)
+
run_context.load(@run_list_expansion)
if specific_recipes
specific_recipes.each do |recipe_file|
run_context.load_recipe_file(recipe_file)
end
end
+
+ events.cookbook_compilation_complete(run_context)
+
run_context
end
diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb
index 3e7462f0ed..bedbe651a1 100644
--- a/lib/chef/policy_builder/policyfile.rb
+++ b/lib/chef/policy_builder/policyfile.rb
@@ -192,8 +192,12 @@ class Chef
setup_chef_class(run_context)
+ events.cookbook_compilation_start(run_context)
+
run_context.load(run_list_expansion_ish)
+ events.cookbook_compilation_complete(run_context)
+
setup_chef_class(run_context)
run_context
end