summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/ast/hostclass.rb8
-rw-r--r--lib/puppet/parser/ast/node.rb9
-rw-r--r--lib/puppet/parser/functions.rb12
3 files changed, 17 insertions, 12 deletions
diff --git a/lib/puppet/parser/ast/hostclass.rb b/lib/puppet/parser/ast/hostclass.rb
index 503802b93..8290f4ef0 100644
--- a/lib/puppet/parser/ast/hostclass.rb
+++ b/lib/puppet/parser/ast/hostclass.rb
@@ -20,6 +20,10 @@ class Puppet::Parser::AST
return nil
end
+ # Set the class before we do anything else, so that it's set
+ # during the evaluation and can be inspected.
+ scope.setclass(self.object_id, @type)
+
# Default to creating a new context
newcontext = true
if parentscope = self.evalparent(
@@ -45,10 +49,6 @@ class Puppet::Parser::AST
:name => objname,
:newcontext => newcontext
)
-
- # Set the mark after we evaluate, so we don't record it but
- # then encounter an error
- scope.setclass(self.object_id, @type)
return retval
end
diff --git a/lib/puppet/parser/ast/node.rb b/lib/puppet/parser/ast/node.rb
index 2a8e6a85b..f1b128ccf 100644
--- a/lib/puppet/parser/ast/node.rb
+++ b/lib/puppet/parser/ast/node.rb
@@ -36,13 +36,14 @@ class Puppet::Parser::AST
# already been defined at this top-level scope.
#super(scope, facts, @name, @name)
- # And then evaluate our code.
- @code.safeevaluate(:scope => scope)
-
# Mark our node name as a class, too, but strip it of the domain
- # name.
+ # name. Make the mark before we evaluate the code, so that it is
+ # marked within the code itself.
scope.setclass(self.object_id, @type.sub(/\..+/, ''))
+ # And then evaluate our code.
+ @code.safeevaluate(:scope => scope)
+
return scope
end
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index 61070627f..63201924b 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -91,11 +91,15 @@ module Functions
newfunction(:tagged, :rvalue) do |vals|
classlist = self.classlist
- if vals.find do |val| ! classlist.include?(val) end
- return false
- else
- return true
+ retval = true
+ vals.each do |val|
+ unless classlist.include?(val) or self.tags.include?(val)
+ retval = false
+ break
+ end
end
+
+ return retval
end
# Test whether a given class or definition is defined