lib/chef/client.rb in chef-10.14.0.beta.3 vs lib/chef/client.rb in chef-10.14.0.rc.0
- old
+ new
@@ -222,10 +222,16 @@
unless name
msg = "Unable to determine node name: configure node_name or configure the system's hostname and fqdn"
raise Chef::Exceptions::CannotDetermineNodeName, msg
end
+ # node names > 90 bytes only work with authentication protocol >= 1.1
+ # see discussion in config.rb.
+ if name.bytesize > 90
+ Chef::Config[:authentication_protocol_version] = "1.1"
+ end
+
name
end
# Applies environment, external JSON attributes, and override run list to
# the node, Then expands the run_list.
@@ -419,13 +425,17 @@
Chef::Log.info("Chef Run complete in #{run_status.elapsed_time} seconds")
run_completed_successfully
@events.run_completed(node)
true
rescue Exception => e
- run_status.stop_clock
- run_status.exception = e
- run_failed
+ # CHEF-3336: Send the error first in case something goes wrong below and we don't know why
Chef::Log.debug("Re-raising exception: #{e.class} - #{e.message}\n#{e.backtrace.join("\n ")}")
+ # If we failed really early, we may not have a run_status yet. Too early for these to be of much use.
+ if run_status
+ run_status.stop_clock
+ run_status.exception = e
+ run_failed
+ end
@events.run_failed(e)
raise
ensure
run_status = nil
run_context = nil