summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/node.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-02-12 14:19:19 -0600
committerLuke Kanies <luke@madstop.com>2008-02-12 14:19:19 -0600
commitc8da318a2a4445e0ce10c76a7fbb64635b291ccd (patch)
tree3e9f1495f1779f18a8282f9a62a4c4ad97ecd6e4 /lib/puppet/parser/ast/node.rb
parent8b2fae019b31513becd002eb474e1b4803abde24 (diff)
downloadpuppet-c8da318a2a4445e0ce10c76a7fbb64635b291ccd.tar.gz
puppet-c8da318a2a4445e0ce10c76a7fbb64635b291ccd.tar.xz
puppet-c8da318a2a4445e0ce10c76a7fbb64635b291ccd.zip
Moving the ast node tests to rspec (which I could have
*sworn* I did this weekend). In the process, I fixed a couple of bugs related to differentiating between nodes and classes, and then cleaned up quite a few error messages.
Diffstat (limited to 'lib/puppet/parser/ast/node.rb')
-rw-r--r--lib/puppet/parser/ast/node.rb34
1 files changed, 6 insertions, 28 deletions
diff --git a/lib/puppet/parser/ast/node.rb b/lib/puppet/parser/ast/node.rb
index 8cebac8a8..2bf6c1882 100644
--- a/lib/puppet/parser/ast/node.rb
+++ b/lib/puppet/parser/ast/node.rb
@@ -5,34 +5,6 @@ require 'puppet/parser/ast/hostclass'
class Puppet::Parser::AST::Node < Puppet::Parser::AST::HostClass
@name = :node
- # Evaluate the code associated with our node definition.
- def evaluate_code(resource)
- scope = resource.scope
-
- # We don't have to worry about the declarativeness of node parentage,
- # because the entry point is always a single node definition.
- if parent = self.parentobj
- scope = parent.evaluate_code(resource)
- end
-
- scope = scope.newscope(
- :resource => resource,
- :keyword => @keyword,
- :source => self,
- :namespace => "" # nodes are always in ""
- )
-
- # Mark our node name as a class, too, but strip it of the domain
- # name. Make the mark before we evaluate the code, so that it is
- # marked within the code itself.
- scope.compiler.class_set(self.classname, scope)
-
- # And then evaluate our code if we have any
- @code.safeevaluate(scope) if self.code
-
- return scope
- end
-
def initialize(options)
@parentclass = nil
super
@@ -43,13 +15,19 @@ class Puppet::Parser::AST::Node < Puppet::Parser::AST::HostClass
end
end
+ def namespace
+ ""
+ end
+
# Make sure node scopes are marked as such.
def subscope(*args)
scope = super
scope.nodescope = true
+ scope
end
private
+
# Search for the object matching our parent class.
def find_parentclass
@parser.findnode(parentclass)