summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector/yaml.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-08-14 18:25:24 -0700
committerMarkus Roberts <Markus@reality.com>2010-08-21 13:07:21 -0700
commit82b4f04f6b8fee7ada275fc63e519a08e1c2b0a5 (patch)
tree9c8aaad15269c36b612639901f0c7402a4e74294 /lib/puppet/indirector/yaml.rb
parent0c3075443c80227c1e35cfb4952d3971c1c0adeb (diff)
downloadpuppet-82b4f04f6b8fee7ada275fc63e519a08e1c2b0a5.tar.gz
puppet-82b4f04f6b8fee7ada275fc63e519a08e1c2b0a5.tar.xz
puppet-82b4f04f6b8fee7ada275fc63e519a08e1c2b0a5.zip
Maint. -- Fix test failures broken by previous commit
This basically involved adding a search method to the yaml indirector, which I did by copying the one from ssl_file and fiddling with it until the tests passed. Since the most straight forward way to do this required extending the interface to the path method I added tests for the additional behaviour.
Diffstat (limited to 'lib/puppet/indirector/yaml.rb')
-rw-r--r--lib/puppet/indirector/yaml.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/puppet/indirector/yaml.rb b/lib/puppet/indirector/yaml.rb
index 13f3c1e79..23997e97a 100644
--- a/lib/puppet/indirector/yaml.rb
+++ b/lib/puppet/indirector/yaml.rb
@@ -42,9 +42,15 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
end
# Return the path to a given node's file.
- def path(name)
+ def path(name,ext='.yaml')
base = Puppet.run_mode.master? ? Puppet[:yamldir] : Puppet[:clientyamldir]
- File.join(base, self.class.indirection_name.to_s, name.to_s + ".yaml")
+ File.join(base, self.class.indirection_name.to_s, name.to_s + ext)
+ end
+
+ def search(request)
+ Dir.glob(path(request.key,'')).collect do |file|
+ YAML.load_file(file)
+ end
end
private