226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
|
# File 'lib/chef/application/solo.rb', line 226
def run_application
if Chef::Config[:daemonize]
Chef::Daemon.daemonize("chef-client")
end
loop do
begin
if Chef::Config[:splay]
splay = rand Chef::Config[:splay]
Chef::Log.debug("Splay sleep #{splay} seconds")
sleep splay
end
run_chef_client
if Chef::Config[:interval]
Chef::Log.debug("Sleeping for #{Chef::Config[:interval]} seconds")
sleep Chef::Config[:interval]
else
Chef::Application.exit! "Exiting", 0
end
rescue SystemExit => e
raise
rescue Exception => e
if Chef::Config[:interval]
Chef::Log.error("#{e.class}: #{e}")
Chef::Log.debug("#{e.class}: #{e}\n#{e.backtrace.join("\n")}")
Chef::Log.fatal("Sleeping for #{Chef::Config[:interval]} seconds before trying again")
sleep Chef::Config[:interval]
retry
else
Chef::Application.debug_stacktrace(e)
Chef::Application.fatal!("#{e.class}: #{e.message}", 1)
end
end
end
end
|