From 82b4f04f6b8fee7ada275fc63e519a08e1c2b0a5 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sat, 14 Aug 2010 18:25:24 -0700 Subject: 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. --- lib/puppet/indirector/yaml.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/puppet/indirector') 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 -- cgit