def self.parse_json
if Chef::Config[:json_attribs]
begin
json_io = open(Chef::Config[:json_attribs])
rescue SocketError => error
fatal!("I cannot connect to #{Chef::Config[:json_attribs]}", 2)
rescue Errno::ENOENT => error
fatal!("I cannot find #{Chef::Config[:json_attribs]}", 2)
rescue Errno::EACCES => error
fatal!("Permissions are incorrect on #{Chef::Config[:json_attribs]}. Please chmod a+r #{Chef::Config[:json_attribs]}", 2)
rescue Exception => error
fatal!("Got an unexpected error reading #{Chef::Config[:json_attribs]}: #{error.message}", 2)
end
begin
@json_attribs = JSON.parse(json_io.read)
rescue JSON::ParserError => error
fatal!("Could not parse the provided JSON file (#{Chef::Config[:json_attribs]})!: " + error.message, 2)
end
end
end