summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/ast')
-rw-r--r--lib/puppet/parser/ast/node.rb6
-rw-r--r--lib/puppet/parser/ast/nodedef.rb6
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/puppet/parser/ast/node.rb b/lib/puppet/parser/ast/node.rb
index e8f4c5d87..97e8de06e 100644
--- a/lib/puppet/parser/ast/node.rb
+++ b/lib/puppet/parser/ast/node.rb
@@ -3,18 +3,18 @@ class Puppet::Parser::AST
# other objects. That's just the way it is, at least for now.
class Node < AST::HostClass
@name = :node
- attr_accessor :name, :args, :code, :parentclass
+ attr_accessor :type, :args, :code, :parentclass
#def evaluate(scope, facts = {})
def evaluate(hash)
scope = hash[:scope]
facts = hash[:facts] || {}
+ #scope.info "name is %s, type is %s" % [self.name, self.type]
# nodes are never instantiated like a normal object,
# but we need the type to be the name users would use for
# instantiation, otherwise tags don't work out
scope = scope.newscope(
- :type => @name,
- :name => @name,
+ :type => self.type,
:keyword => @keyword
)
scope.context = self.object_id
diff --git a/lib/puppet/parser/ast/nodedef.rb b/lib/puppet/parser/ast/nodedef.rb
index d41eeecde..cc710329f 100644
--- a/lib/puppet/parser/ast/nodedef.rb
+++ b/lib/puppet/parser/ast/nodedef.rb
@@ -21,8 +21,12 @@ class Puppet::Parser::AST
names.each { |name|
#Puppet.debug("defining host '%s' in scope %s" %
# [name, scope.object_id])
+ # We use 'type' here instead of name, because every component
+ # type supports both 'type' and 'name', and 'type' is a more
+ # appropriate description of the syntactic role that this term
+ # plays.
arghash = {
- :name => name,
+ :type => name,
:code => @code
}