[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585
James Turnbull
james at lovedthanlost.net
Fri Jan 23 14:21:29 UTC 2009
The following commit has been merged in the master branch:
commit f21623735deaeb5cd4207a24983ab985f0f9e6af
Author: Sean E. Millichamp <sean at bruenor.org>
Date: Wed Oct 22 11:04:45 2008 -0400
Fixes #1663 - added Symbol check and additional test
diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb
index 00f3640..036f660 100644
--- a/lib/puppet/parser/templatewrapper.rb
+++ b/lib/puppet/parser/templatewrapper.rb
@@ -83,7 +83,11 @@ class Puppet::Parser::TemplateWrapper
# to the regular methods.
benchmark(:debug, "Bound template variables for #{file}") do
scope.to_hash.each { |name, value|
- realname = name.gsub(/[^\w]/, "_")
+ if name.kind_of?(String)
+ realname = name.gsub(/[^\w]/, "_")
+ else
+ realname = name
+ end
instance_variable_set("@#{realname}", value)
}
end
diff --git a/spec/unit/parser/templatewrapper.rb b/spec/unit/parser/templatewrapper.rb
index 6dbfbe2..5327762 100755
--- a/spec/unit/parser/templatewrapper.rb
+++ b/spec/unit/parser/templatewrapper.rb
@@ -86,6 +86,15 @@ describe Puppet::Parser::TemplateWrapper do
@tw.instance_variable_get("@one").should == "foo"
end
+ it "should not error out if one of the variables is a symbol" do
+ template_mock = mock("template", :result => "woot!")
+ File.expects(:read).with("/tmp/fake_template").returns("template contents")
+ ERB.expects(:new).with("template contents", 0, "-").returns(template_mock)
+
+ @scope.expects(:to_hash).returns(:_timestamp => "1234")
+ @tw.result
+ end
+
%w{! . ; :}.each do |badchar|
it "should translate #{badchar} to _ when setting the instance variables" do
template_mock = mock("template", :result => "woot!")
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list