lib/puppet/network/http/handler.rb in puppet-2.7.26 vs lib/puppet/network/http/handler.rb in puppet-3.0.0.rc4

- old
+ new

@@ -1,16 +1,16 @@ module Puppet::Network::HTTP end require 'puppet/network/http/api/v1' -require 'puppet/network/rest_authorization' +require 'puppet/network/authorization' require 'puppet/network/rights' require 'resolv' module Puppet::Network::HTTP::Handler include Puppet::Network::HTTP::API::V1 - include Puppet::Network::RestAuthorization + include Puppet::Network::Authorization attr_reader :server, :handler # Retrieve the accept header from the http request. def accept_header(request) @@ -68,12 +68,10 @@ send("do_#{method}", indirection, key, params, request, response) rescue SystemExit,NoMemoryError raise rescue Exception => e return do_exception(response, e) - ensure - cleanup(request) end # Set the response up, with the body and status. def set_response(response, body, status = 200) raise NotImplementedError @@ -89,15 +87,11 @@ # make sure we return the correct status code # for authorization issues status = 403 if status == 400 end if exception.is_a?(Exception) - if Puppet[:trace] then - puts exception.backtrace - Puppet.err(exception.backtrace.join("\n")) - end - Puppet.err(exception) + Puppet.log_exception(exception) end set_content_type(response, "text/plain") set_response(response, exception.to_s, status) end @@ -220,14 +214,10 @@ def params(request) raise NotImplementedError end - def cleanup(request) - # By default, there is nothing to cleanup. - end - def decode_params(params) params.inject({}) do |result, ary| param, value = ary next result if param.nil? || param.empty? @@ -237,10 +227,10 @@ # in the query string, for security reasons. next result if param == :node next result if param == :ip value = CGI.unescape(value) if value =~ /^---/ - value = YAML.load(value, :safe => true, :deserialize_symbols => true) + value = YAML.load(value) else value = true if value == "true" value = false if value == "false" value = Integer(value) if value =~ /^\d+$/ value = value.to_f if value =~ /^\d+\.\d+$/