diff options
author | tyler-ball <tyleraball@gmail.com> | 2014-10-31 07:05:21 -0700 |
---|---|---|
committer | tyler-ball <tyleraball@gmail.com> | 2014-10-31 07:05:21 -0700 |
commit | 94947461dc3b28494053a86fee5d5004bdbd9692 (patch) | |
tree | e302951600373603659b615744ee4904a32e120f | |
parent | 2032e6179e9548038bfdc734c8c3b77fc4ea9273 (diff) | |
download | chef-94947461dc3b28494053a86fee5d5004bdbd9692.tar.gz |
Adding error handling so saving node doesn't prevent us from running audit mode - decouples converge phase and audit phase more
-rw-r--r-- | lib/chef/client.rb | 16 |
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 |