From ac7f59618a80b6a4aac777f6184e7fa6a0614079 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Sun, 15 Jun 2008 14:39:45 -0500 Subject: Fixed #1201 - all external node attributes are converted to strings. --- CHANGELOG | 2 ++ lib/puppet/indirector/node/exec.rb | 7 +++++++ spec/unit/indirector/node/exec.rb | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index d51e3f0b6..2c59aac9b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ + Fixed #1201 - all external node attributes are converted to strings. + Adding a ResourceTemplate class for using templates directly within resources (i.e., client-side templates). This would really only be used for composite resources that pass the results of the diff --git a/lib/puppet/indirector/node/exec.rb b/lib/puppet/indirector/node/exec.rb index 52cbc370c..029a35c4f 100644 --- a/lib/puppet/indirector/node/exec.rb +++ b/lib/puppet/indirector/node/exec.rb @@ -30,6 +30,13 @@ class Puppet::Node::Exec < Puppet::Indirector::Exec def create_node(name, result) node = Puppet::Node.new(name) set = false + if current = result[:parameters] + result[:parameters] = current.inject({}) do |strings, ary| + param, value = ary + strings[param] = value.to_s + strings + end + end [:parameters, :classes, :environment].each do |param| if value = result[param] node.send(param.to_s + "=", value) diff --git a/spec/unit/indirector/node/exec.rb b/spec/unit/indirector/node/exec.rb index 09f13ab90..2276e4298 100755 --- a/spec/unit/indirector/node/exec.rb +++ b/spec/unit/indirector/node/exec.rb @@ -49,6 +49,12 @@ describe Puppet::Node::Exec do @searcher.find(@request) end + it "should convert all parameters into strings" do + @result[:parameters] = {"a" => true, "c" => 100} + @node.expects(:parameters=).with "a" => "true", "c" => "100" + @searcher.find(@request) + end + it "should set the resulting classes as the node classes" do @result[:classes] = %w{one two} @node.expects(:classes=).with %w{one two} -- cgit