diff options
| author | Luke Kanies <luke@madstop.com> | 2008-08-18 11:47:40 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-08-18 11:47:40 -0500 |
| commit | e3971b9751141cd448a8197da024be43581f6dcd (patch) | |
| tree | 3ae780db3d9dae0a4df10ec24f928bf3a844e749 /lib/puppet/indirector | |
| parent | 025edc5c3737f476119df4bab73ebdc68be19430 (diff) | |
| parent | 2ec4e298c3274abc8eaad4230bca8d39a48d2e35 (diff) | |
| download | puppet-e3971b9751141cd448a8197da024be43581f6dcd.tar.gz puppet-e3971b9751141cd448a8197da024be43581f6dcd.tar.xz puppet-e3971b9751141cd448a8197da024be43581f6dcd.zip | |
Merge branch '0.24.x'
Conflicts:
CHANGELOG
test/util/posixtest.rb
Diffstat (limited to 'lib/puppet/indirector')
| -rw-r--r-- | lib/puppet/indirector/facts/facter.rb | 5 | ||||
| -rw-r--r-- | lib/puppet/indirector/yaml.rb | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb index 465d90c13..6ed89dac1 100644 --- a/lib/puppet/indirector/facts/facter.rb +++ b/lib/puppet/indirector/facts/facter.rb @@ -12,12 +12,13 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code Dir.entries(dir).find_all { |e| e =~ /\.rb$/ }.each do |file| fqfile = ::File.join(dir, file) begin - Puppet.info "Loading #{type} %s" % ::File.basename(file.sub(".rb",'')) + Puppet.info "Loading %s %s" % + [type, ::File.basename(file.sub(".rb",''))] Timeout::timeout(self.timeout) do load fqfile end rescue => detail - Puppet.warning "Could not load #{type} %s: %s" % [fqfile, detail] + Puppet.warning "Could not load %s %s: %s" % [type, fqfile, detail] end end end 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 |
