diff options
author | Rick Bradley <rick@rickbradley.com> | 2008-04-01 23:40:28 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-04-11 13:10:38 -0500 |
commit | b75048202219f2e07a211df3400a0ee88ccfd208 (patch) | |
tree | 9b2c72f77d8cdcfd8f4faf92dc2264a369aae34b /lib/puppet | |
parent | a7f2dd464b46bfd55470a6bf679235552d200216 (diff) | |
download | puppet-b75048202219f2e07a211df3400a0ee88ccfd208.tar.gz puppet-b75048202219f2e07a211df3400a0ee88ccfd208.tar.xz puppet-b75048202219f2e07a211df3400a0ee88ccfd208.zip |
unit specs and implementation for Indirector::REST#search method
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/indirector/rest.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb index 4c54183c6..690c79632 100644 --- a/lib/puppet/indirector/rest.rb +++ b/lib/puppet/indirector/rest.rb @@ -13,4 +13,12 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus raise YAML.load(network_result) if network_result =~ %r{--- !ruby/exception} decoded_result = indirection.model.from_yaml(network_result) end + + def search(key, options = {}) + network_results = network_fetch("#{indirection.name}s/#{key}") + raise YAML.load(network_results) if network_results =~ %r{--- !ruby/exception} + decoded_results = network_results.collect do |result| + indirection.model.from_yaml(result) + end + end end |