diff options
| author | Luke Kanies <luke@madstop.com> | 2007-10-22 19:28:22 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-10-22 19:28:22 -0500 |
| commit | 688fcdf11a685dfda297beff50de8d4c751494d9 (patch) | |
| tree | f2d737a2382de16a43e3d37f09dab2c76ad57d91 /lib/puppet/indirector/file_metadata | |
| parent | 393a3e8743f503543ad34a874e9296d684b0d49b (diff) | |
| download | puppet-688fcdf11a685dfda297beff50de8d4c751494d9.tar.gz puppet-688fcdf11a685dfda297beff50de8d4c751494d9.tar.xz puppet-688fcdf11a685dfda297beff50de8d4c751494d9.zip | |
Adding searchability to the fileserving termini, using the
new Fileset class.
The tests aren't the cleanest, in that there is still
a good bit of duplication in them, but it's what we got.
Diffstat (limited to 'lib/puppet/indirector/file_metadata')
| -rw-r--r-- | lib/puppet/indirector/file_metadata/local.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/puppet/indirector/file_metadata/local.rb b/lib/puppet/indirector/file_metadata/local.rb index f40d4ce43..86e1172f9 100644 --- a/lib/puppet/indirector/file_metadata/local.rb +++ b/lib/puppet/indirector/file_metadata/local.rb @@ -3,6 +3,7 @@ # Copyright (c) 2007. All rights reserved. require 'puppet/file_serving/metadata' +require 'puppet/file_serving/terminus_helper' require 'puppet/indirector/file_metadata' require 'puppet/util/uri_helper' require 'puppet/indirector/code' @@ -11,6 +12,7 @@ class Puppet::Indirector::FileMetadata::Local < Puppet::Indirector::Code desc "Retrieve file metadata directly from the local filesystem." include Puppet::Util::URIHelper + include Puppet::FileServing::TerminusHelper def find(key) uri = key2uri(key) @@ -21,4 +23,10 @@ class Puppet::Indirector::FileMetadata::Local < Puppet::Indirector::Code return data end + + def search(key, options = {}) + uri = key2uri(key) + return nil unless FileTest.exists?(uri.path) + path2instances(uri.path, options).each { |instance| instance.get_attributes } + end end |
