summaryrefslogtreecommitdiffstats
path: root/lib/puppet/file_serving
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-08-26 23:29:04 -0700
committerLuke Kanies <luke@madstop.com>2008-08-26 23:29:04 -0700
commitac419872e273dc31635f042bb1a23c7785dc227a (patch)
treeb48e5db043409ab88cdd5bc63af2fa7ffbf5e91e /lib/puppet/file_serving
parentbe4c0e7fbe5e652ec1d49eab2fdc7a5fbbc486f3 (diff)
downloadpuppet-ac419872e273dc31635f042bb1a23c7785dc227a.tar.gz
puppet-ac419872e273dc31635f042bb1a23c7785dc227a.tar.xz
puppet-ac419872e273dc31635f042bb1a23c7785dc227a.zip
Fixing the terminus helper so it correctly catches options passed from clients via REST.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/file_serving')
-rw-r--r--lib/puppet/file_serving/terminus_helper.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/puppet/file_serving/terminus_helper.rb b/lib/puppet/file_serving/terminus_helper.rb
index 598a5007a..b51e27297 100644
--- a/lib/puppet/file_serving/terminus_helper.rb
+++ b/lib/puppet/file_serving/terminus_helper.rb
@@ -9,7 +9,16 @@ require 'puppet/file_serving/fileset'
module Puppet::FileServing::TerminusHelper
# Create model instances for all files in a fileset.
def path2instances(request, path)
- args = [:links, :ignore, :recurse].inject({}) { |hash, param| hash[param] = request.options[param] if request.options[param]; hash }
+ args = [:links, :ignore, :recurse].inject({}) do |hash, param|
+ if request.options.include?(param) # use 'include?' so the values can be false
+ hash[param] = request.options[param]
+ elsif request.options.include?(param.to_s)
+ hash[param] = request.options[param.to_s]
+ end
+ hash[param] = true if hash[param] == "true"
+ hash[param] = false if hash[param] == "false"
+ hash
+ end
Puppet::FileServing::Fileset.new(path, args).files.collect do |file|
inst = model.new(path, :relative_path => file)
inst.links = request.options[:links] if request.options[:links]