summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/indirector')
-rw-r--r--lib/puppet/indirector/rest.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb
index 7b7c932c4..4c54183c6 100644
--- a/lib/puppet/indirector/rest.rb
+++ b/lib/puppet/indirector/rest.rb
@@ -1,8 +1,16 @@
-require 'puppet/indirector/rest'
+require 'net/http'
+require 'uri'
# Access objects via REST
class Puppet::Indirector::REST < Puppet::Indirector::Terminus
+ def network_fetch(path)
+ # TODO: url_encode path, set proper server + port
+ Net::HTTP.get(URI.parse("http://127.0.0.1:34343/#{path}"))
+ end
+
def find(name, options = {})
- indirection.model.new(name)
+ network_result = network_fetch("#{indirection.name}/#{name}")
+ raise YAML.load(network_result) if network_result =~ %r{--- !ruby/exception}
+ decoded_result = indirection.model.from_yaml(network_result)
end
end