summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2014-02-03 14:17:45 -0800
committerdanielsdeleo <dan@opscode.com>2014-02-03 14:40:10 -0800
commitfff56de8754f520f199011cdd1e0f7b4694bdbae (patch)
treeb6c02ee1822463996f867008687ce6cff5aa232e
parent72606301614b846c5c3a996d1cedfbd2c8de2955 (diff)
downloadchef-fff56de8754f520f199011cdd1e0f7b4694bdbae.tar.gz
Delegate sync_cookbooks to policy_builder, subclasses rely on it
-rw-r--r--lib/chef/client.rb4
-rw-r--r--lib/chef/policy_builder/expand_node_object.rb8
-rw-r--r--lib/chef/policy_builder/policyfile.rb2
-rw-r--r--spec/unit/policy_builder/expand_node_object_spec.rb4
4 files changed, 13 insertions, 5 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 5fe2c07d7e..cb4a9e1224 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -255,6 +255,10 @@ class Chef
run_context
end
+ def sync_cookbooks
+ policy_builder.sync_cookbooks
+ end
+
def policy_builder
@policy_builder ||= Chef::PolicyBuilder.strategy.new(node_name, ohai.data, json_attribs, @override_runlist, events)
end
diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb
index 11a667aef9..dbb11380c8 100644
--- a/lib/chef/policy_builder/expand_node_object.rb
+++ b/lib/chef/policy_builder/expand_node_object.rb
@@ -155,10 +155,6 @@ class Chef
raise
end
- ########################################
- # Internal public API
- ########################################
-
# Sync_cookbooks eagerly loads all files except files and
# templates. It returns the cookbook_hash -- the return result
# from /environments/#{node.chef_environment}/cookbook_versions,
@@ -190,6 +186,10 @@ class Chef
cookbook_hash
end
+ ########################################
+ # Internal public API
+ ########################################
+
def setup_run_list_override
runlist_override_sanity_check!
unless(override_runlist.empty?)
diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb
index 4373c36c86..e9041d5c0f 100644
--- a/lib/chef/policy_builder/policyfile.rb
+++ b/lib/chef/policy_builder/policyfile.rb
@@ -174,7 +174,6 @@ class Chef
run_list_expansion_ish
end
- ## Internal Public API ##
def sync_cookbooks
Chef::Log.debug("Synchronizing cookbooks")
@@ -187,6 +186,7 @@ class Chef
cookbooks_to_sync
end
+ ## Internal Public API ##
def run_list_with_versions_for_display
run_list.map do |recipe_spec|
diff --git a/spec/unit/policy_builder/expand_node_object_spec.rb b/spec/unit/policy_builder/expand_node_object_spec.rb
index bca48b0914..dc8b532e2b 100644
--- a/spec/unit/policy_builder/expand_node_object_spec.rb
+++ b/spec/unit/policy_builder/expand_node_object_spec.rb
@@ -55,6 +55,10 @@ describe Chef::PolicyBuilder::ExpandNodeObject do
expect(policy_builder).to respond_to(:expand_run_list)
end
+ it "implements a sync_cookbooks method" do
+ expect(policy_builder).to respond_to(:sync_cookbooks)
+ end
+
describe "loading the node" do
context "on chef-solo" do