def reconfigure
super
Chef::Config[:chef_server_url] = config[:chef_server_url] if config.has_key? :chef_server_url
if Chef::Config[:daemonize]
Chef::Config[:interval] ||= 1800
end
if Chef::Config[:once]
Chef::Config[:interval] = nil
Chef::Config[:splay] = nil
end
if Chef::Config[:json_attribs]
begin
json_io = case Chef::Config[:json_attribs]
when /^(http|https):\/\//
@rest = Chef::REST.new(Chef::Config[:json_attribs], nil, nil)
@rest.get_rest(Chef::Config[:json_attribs], true).open
else
open(Chef::Config[:json_attribs])
end
rescue SocketError => error
Chef::Application.fatal!("I cannot connect to #{Chef::Config[:json_attribs]}", 2)
rescue Errno::ENOENT => error
Chef::Application.fatal!("I cannot find #{Chef::Config[:json_attribs]}", 2)
rescue Errno::EACCES => error
Chef::Application.fatal!("Permissions are incorrect on #{Chef::Config[:json_attribs]}. Please chmod a+r #{Chef::Config[:json_attribs]}", 2)
rescue Exception => error
Chef::Application.fatal!("Got an unexpected error reading #{Chef::Config[:json_attribs]}: #{error.message}", 2)
end
begin
@chef_client_json = JSON.parse(json_io.read)
json_io.close unless json_io.closed?
rescue JSON::ParserError => error
Chef::Application.fatal!("Could not parse the provided JSON file (#{Chef::Config[:json_attribs]})!: " + error.message, 2)
end
end
end