Sha256: 120245f0c8bee28bb1af1ce0cd8e202fc3fa7bf09e432eecc27645c685693e51

Contents?: true

Size: 845 Bytes

Versions: 3

Compression:

Stored size: 845 Bytes

Contents

require 'puppet/parser/ast/hostclass'

# The specific code associated with a host.  Nodes are annoyingly unlike
# other objects.  That's just the way it is, at least for now.
class Puppet::Parser::AST::Node < Puppet::Parser::AST::HostClass

    associates_doc

    @name = :node

    def initialize(options)
        @parentclass = nil
        super

        # Do some validation on the node name
        if @name =~ /[^-\w.]/
            raise Puppet::ParseError, "Invalid node name %s" % @name
        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)
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
puppet-0.24.9 lib/puppet/parser/ast/node.rb
puppet-0.24.7 lib/puppet/parser/ast/node.rb
puppet-0.24.8 lib/puppet/parser/ast/node.rb