summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAJ Christensen <aj@junglist.gen.nz>2008-07-30 11:33:18 +1200
committerJames Turnbull <james@lovedthanlost.net>2008-08-01 07:08:08 +1000
commit5c53617aba31abaa7becd9725155b570fac2a90d (patch)
tree87a934b94a3a0247410c7310667f29d5aacfe780
parent482489ad21e20ee3275185962f76c6a0c9a88328 (diff)
downloadpuppet-5c53617aba31abaa7becd9725155b570fac2a90d.tar.gz
puppet-5c53617aba31abaa7becd9725155b570fac2a90d.tar.xz
puppet-5c53617aba31abaa7becd9725155b570fac2a90d.zip
Added a search method to the YAML indirector.
This performs a glob on the YAML directory, and instances everything it finds
-rw-r--r--lib/puppet/indirector/yaml.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/puppet/indirector/yaml.rb b/lib/puppet/indirector/yaml.rb
index 3573ba560..3f05ce618 100644
--- a/lib/puppet/indirector/yaml.rb
+++ b/lib/puppet/indirector/yaml.rb
@@ -34,11 +34,20 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
end
end
+ # Get the yaml directory
+ def base
+ (Puppet[:name] == "puppetmasterd") ? Puppet[:yamldir] : Puppet[:clientyamldir]
+ end
+
# Return the path to a given node's file.
def path(name)
- base = (Puppet[:name] == "puppetmasterd") ? Puppet[:yamldir] : Puppet[:clientyamldir]
File.join(base, self.class.indirection_name.to_s, name.to_s + ".yaml")
end
+
+ # Do a glob on the yaml directory, loading each file found
+ def search(request)
+ Dir.glob(File.join(base, self.class.indirection_name.to_s, request.key)).collect { |f| YAML.load_file(f) }
+ end
private