From ac419872e273dc31635f042bb1a23c7785dc227a Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 26 Aug 2008 23:29:04 -0700 Subject: Fixing the terminus helper so it correctly catches options passed from clients via REST. Signed-off-by: Luke Kanies --- lib/puppet/file_serving/terminus_helper.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib/puppet') 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] -- cgit