diff options
author | danielsdeleo <dan@opscode.com> | 2014-02-03 17:01:10 -0800 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2014-02-03 17:01:10 -0800 |
commit | 040865b55964056d3249de896baafe60587f5105 (patch) | |
tree | f7fedd3b65675a110bf137267850241383cd8476 /lib | |
parent | d472efe27b3c9cd77902002f4158969d5d9eda15 (diff) | |
parent | 196a36ed5e8d6a2c4ba8703d53ed0f6fd9e5922e (diff) | |
download | chef-040865b55964056d3249de896baafe60587f5105.tar.gz |
Merge branch 'CHEF-3506'
Related:
https://tickets.opscode.com/browse/CHEF-3506
https://tickets.opscode.com/browse/CHEF-3964
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/client.rb | 10 | ||||
-rw-r--r-- | lib/chef/policy_builder/expand_node_object.rb | 7 | ||||
-rw-r--r-- | lib/chef/policy_builder/policyfile.rb | 6 |
3 files changed, 18 insertions, 5 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb index cb4a9e1224..722c9915e9 100644 --- a/lib/chef/client.rb +++ b/lib/chef/client.rb @@ -265,12 +265,12 @@ class Chef def save_updated_node - unless Chef::Config[:solo] + if Chef::Config[:solo] + # nothing to do + elsif policy_builder.temporary_policy? + Chef::Log.warn("Skipping final node save because override_runlist was given") + else Chef::Log.debug("Saving the current state of node #{node_name}") - if(@original_runlist) - @node.run_list(*@original_runlist) - @node.automatic_attrs[:runlist_override_history] = {Time.now.to_i => @override_runlist.inspect} - end @node.save end end diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb index dbb11380c8..38b8b7551b 100644 --- a/lib/chef/policy_builder/expand_node_object.rb +++ b/lib/chef/policy_builder/expand_node_object.rb @@ -186,6 +186,13 @@ class Chef cookbook_hash end + # Indicates whether the policy is temporary, which means an + # override_runlist was provided. Chef::Client uses this to decide whether + # to do the final node save at the end of the run or not. + def temporary_policy? + !!@original_runlist + end + ######################################## # Internal public API ######################################## diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb index e9041d5c0f..19b9aaf542 100644 --- a/lib/chef/policy_builder/policyfile.rb +++ b/lib/chef/policy_builder/policyfile.rb @@ -186,6 +186,12 @@ class Chef cookbooks_to_sync end + # Whether or not this is a temporary policy. Since PolicyBuilder doesn't + # support override_runlist, this is always false. + def temporary_policy? + false + end + ## Internal Public API ## def run_list_with_versions_for_display |