summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/indirector/rest.rb10
-rw-r--r--lib/puppet/network/http/handler.rb4
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb
index 20c837fc9..c33b8a949 100644
--- a/lib/puppet/indirector/rest.rb
+++ b/lib/puppet/indirector/rest.rb
@@ -5,7 +5,7 @@ require 'uri'
class Puppet::Indirector::REST < Puppet::Indirector::Terminus
# Figure out the content type, turn that into a format, and use the format
# to extract the body of the response.
- def deserialize(response)
+ def deserialize(response, multiple = false)
case response.code
when "404"
return nil
@@ -15,7 +15,11 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
end
# Convert the response to a deserialized object.
- model.convert_from(response['content-type'], response.body)
+ if multiple
+ model.convert_from_multiple(response['content-type'], response.body)
+ else
+ model.convert_from(response['content-type'], response.body)
+ end
else
# Raise the http error if we didn't get a 'success' of some kind.
message = "Server returned %s: %s" % [response.code, response.message]
@@ -46,7 +50,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
else
path = "/#{indirection.name}s"
end
- deserialize network.get(path, headers)
+ deserialize(network.get(path, headers), true)
end
def destroy(request)
diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb
index 1a21bfea9..0069933bd 100644
--- a/lib/puppet/network/http/handler.rb
+++ b/lib/puppet/network/http/handler.rb
@@ -81,13 +81,13 @@ module Puppet::Network::HTTP::Handler
# Execute our search.
def do_search(request, response)
args = params(request)
- result = model.search(args).collect {|result| result.to_yaml }.to_yaml
+ result = model.search(args)
# LAK:FAIL This doesn't work.
format = format_to_use(request)
set_content_type(response, format)
- set_response(response, result)
+ set_response(response, model.render_multiple(format, result))
end
# Execute our destroy.