[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:30:13 UTC 2010
The following commit has been merged in the upstream branch:
commit c694c4d34fea8b45695222321930e64b8991887a
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date: Tue Feb 9 22:25:38 2010 +0100
Fix #3150 - require function doesn't like ::class syntax
Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>
diff --git a/lib/puppet/parser/functions/require.rb b/lib/puppet/parser/functions/require.rb
index d72169a..3e79619 100644
--- a/lib/puppet/parser/functions/require.rb
+++ b/lib/puppet/parser/functions/require.rb
@@ -37,6 +37,13 @@ fail if used with earlier clients.
vals = [vals] unless vals.is_a?(Array)
vals.each do |klass|
+ # lookup the class in the scopes
+ if classobj = find_hostclass(klass)
+ klass = classobj.classname
+ else
+ raise Puppet::ParseError, "Could not find class %s" % klass
+ end
+
# This is a bit hackish, in some ways, but it's the only way
# to configure a dependency that will make it to the client.
# The 'obvious' way is just to add an edge in the catalog,
diff --git a/spec/unit/parser/functions/require.rb b/spec/unit/parser/functions/require.rb
index 577a52a..532c069 100755
--- a/spec/unit/parser/functions/require.rb
+++ b/spec/unit/parser/functions/require.rb
@@ -13,6 +13,8 @@ describe "the require function" do
@scope.stubs(:resource).returns @resource
@scope.stubs(:findresource)
@scope.stubs(:compiler).returns(@compiler)
+ @klass = stub 'class', :classname => "myclass"
+ @scope.stubs(:find_hostclass).returns(@klass)
end
it "should exist" do
@@ -45,4 +47,13 @@ describe "the require function" do
@scope.function_require("myclass")
end
+
+ it "should lookup the absolute class path" do
+ @scope.stubs(:function_include)
+
+ @scope.expects(:find_hostclass).with("myclass").returns(@klass)
+ @klass.expects(:classname).returns("myclass")
+
+ @scope.function_require("myclass")
+ end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list