summaryrefslogtreecommitdiff
path: root/lib/chef/client.rb
diff options
context:
space:
mode:
authortyler-ball <tyleraball@gmail.com>2014-10-31 07:05:21 -0700
committertyler-ball <tyleraball@gmail.com>2014-12-17 18:47:25 -0800
commit390b858f2cfb130817573813294cb77b84f71874 (patch)
treee6e1f56bf2911bc7b40516b21cc5df88442f776f /lib/chef/client.rb
parent66665a7f699a592b77249a31af229f1412d90458 (diff)
downloadchef-390b858f2cfb130817573813294cb77b84f71874.tar.gz
Adding error handling so saving node doesn't prevent us from running audit mode - decouples converge phase and audit phase more
Diffstat (limited to 'lib/chef/client.rb')
-rw-r--r--lib/chef/client.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index b41db70689..6c83639ec3 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -326,6 +326,19 @@ class Chef
converge_exception
end
+ # TODO don't want to change old API
+ def converge_and_save(run_context)
+ converge_exception = converge(run_context)
+ unless converge_exception
+ begin
+ save_updated_node
+ rescue Exception => e
+ converge_exception = e
+ end
+ end
+ converge_exception
+ end
+
# TODO are failed audits going to raise exceptions, or only be handled by the reporters?
def run_audits(run_context)
audit_exception = nil
@@ -414,8 +427,7 @@ class Chef
run_context = setup_run_context
- converge_error = converge(run_context)
- save_updated_node unless converge_error
+ converge_error = converge_and_save(run_context)
audit_error = run_audits(run_context)
if converge_error || audit_error