summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/client.rb10
-rw-r--r--lib/chef/policy_builder/expand_node_object.rb7
-rw-r--r--lib/chef/policy_builder/policyfile.rb6
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