diff options
| author | Luke Kanies <luke@madstop.com> | 2007-10-24 17:50:36 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-10-24 17:50:36 -0500 |
| commit | c0a07ac724c27fce8d2673e4466e42d46d68f145 (patch) | |
| tree | 902f2ac332a037af3e56039b757836deef5cfe1c /lib/puppet/file_serving/terminus_helper.rb | |
| parent | 1746751ddc0e5dd5c5d32abe2ddb4d8305d739fc (diff) | |
| download | puppet-c0a07ac724c27fce8d2673e4466e42d46d68f145.tar.gz puppet-c0a07ac724c27fce8d2673e4466e42d46d68f145.tar.xz puppet-c0a07ac724c27fce8d2673e4466e42d46d68f145.zip | |
File serving should work now, both recursive and
single files, across modules, local file system,
and the traditional file server.
This work revolves around making sure that the termini
produce functional file instances, meaning that they
know how to find their content or metadata, which largely
comes down to setting their paths correctly.
I also created a new terminus base class for the local
filesystem, since there was so much common code between
content and metadata.
Diffstat (limited to 'lib/puppet/file_serving/terminus_helper.rb')
| -rw-r--r-- | lib/puppet/file_serving/terminus_helper.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/puppet/file_serving/terminus_helper.rb b/lib/puppet/file_serving/terminus_helper.rb index 9542cbf84..d465aa493 100644 --- a/lib/puppet/file_serving/terminus_helper.rb +++ b/lib/puppet/file_serving/terminus_helper.rb @@ -8,8 +8,12 @@ require 'puppet/file_serving/fileset' # Define some common methods for FileServing termini. module Puppet::FileServing::TerminusHelper # Create model instances for all files in a fileset. - def path2instances(path, options = {}) + def path2instances(key, path, options = {}) args = [:links, :ignore, :recurse].inject({}) { |hash, param| hash[param] = options[param] if options[param]; hash } - Puppet::FileServing::Fileset.new(path, args).files.collect { |file| model.new(file) } + Puppet::FileServing::Fileset.new(path, args).files.collect do |file| + inst = model.new(File.join(key, file), :path => path, :relative_path => file) + inst.links = options[:links] if options[:links] + inst + end end end |
