[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:27 UTC 2009


The following commit has been merged in the master branch:
commit 8a4e2e9378fe617b0d6b7210ed63f6d5e5bd9956
Author: James Turnbull <james at lovedthanlost.net>
Date:   Tue Oct 21 09:50:54 2008 +1100

    Fixed #1663 - Regression relating to facter fact naming from 0.24.5

diff --git a/CHANGELOG b/CHANGELOG
index abd1856..1046384 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 0.24.6
+    Fixed #1663 - Regression relating to facter fact naming from 0.24.5
+
     Fixed #1655 - Provider::Confine::Variable tests are broken
 
     Fixed #1646 - service puppet status does not work as non-root 
diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb
index fc716b0..824fc48 100644
--- a/lib/puppet/parser/templatewrapper.rb
+++ b/lib/puppet/parser/templatewrapper.rb
@@ -78,7 +78,8 @@ class Puppet::Parser::TemplateWrapper
         # to the regular methods.
         benchmark(:debug, "Bound template variables for #{file}") do
             scope.to_hash.each { |name, value| 
-                instance_variable_set("@#{name}", value) 
+                realname = name.gsub(/[^\w]/, "_")
+                instance_variable_set("@#{realname}", value)
             }
         end
 
diff --git a/spec/unit/parser/templatewrapper.rb b/spec/unit/parser/templatewrapper.rb
index 20ea769..a8c4647 100755
--- a/spec/unit/parser/templatewrapper.rb
+++ b/spec/unit/parser/templatewrapper.rb
@@ -78,5 +78,18 @@ describe Puppet::Parser::TemplateWrapper do
         @tw.result
 
         @tw.instance_variable_get("@one").should == "foo"
-    end
+     end
+
+     %w{! . ; :}.each do |badchar|
+       it "should translate #{badchar} to _ when setting the instance variables" 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("one#{badchar}" => "foo")
+        @tw.result
+
+        @tw.instance_variable_get("@one_").should == "foo"
+      end
+     end
 end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list