summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network
diff options
context:
space:
mode:
authorRick Bradley <rick@rickbradley.com>2008-04-02 19:29:04 -0500
committerLuke Kanies <luke@madstop.com>2008-04-11 13:11:28 -0500
commit93bc1a946f2da6e7c78a38ff90dac8a20b1bcbc7 (patch)
treeaf2894a72c59138abdf5a53bcf5e9d7b33948b29 /lib/puppet/network
parent99b295b8301d7a89c97ecdc1d636c2d2b7f1ae8e (diff)
downloadpuppet-93bc1a946f2da6e7c78a38ff90dac8a20b1bcbc7.tar.gz
puppet-93bc1a946f2da6e7c78a38ff90dac8a20b1bcbc7.tar.xz
puppet-93bc1a946f2da6e7c78a38ff90dac8a20b1bcbc7.zip
adding REST save support, with integration tests. A handful of unit tests in that area now need to be updated.
Diffstat (limited to 'lib/puppet/network')
-rw-r--r--lib/puppet/network/http/handler.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb
index 9e6c28512..7113c92d3 100644
--- a/lib/puppet/network/http/handler.rb
+++ b/lib/puppet/network/http/handler.rb
@@ -44,13 +44,17 @@ module Puppet::Network::HTTP::Handler
end
def do_save(request, response)
- data = body(request)
+ data = body(request).to_s
raise ArgumentError, "No data to save" if !data or data.empty?
- args = params(request)
- obj = model.new
- result = obj.save(args.merge(:data => data)).to_yaml
+ # args = params(request)
+ obj = model.from_yaml(data)
+ result = save_object(obj).to_yaml
encode_result(request, response, result)
end
+
+ def save_object(obj)
+ obj.save
+ end
def do_exception(request, response, exception, status=404)
encode_result(request, response, exception.to_yaml, status)