Sha256: b9549f43e08e0fcb617cf64dd564078c6f41b0c11313bdb8afafd2da7fd3ec3e

Contents?: true

Size: 924 Bytes

Versions: 50

Compression:

Stored size: 924 Bytes

Contents

require 'puppet/parser/ast/top_level_construct'

class Puppet::Parser::AST::Node < Puppet::Parser::AST::TopLevelConstruct
  attr_accessor :names, :context

  def initialize(names, context = {}, &ruby_code)
    raise ArgumentError, "names should be an array" unless names.is_a? Array
    if context[:parent]
      msg = "Deprecation notice: Node inheritance is not supported in Puppet >= 4.0.0. See http://links.puppetlabs.com/puppet-node-inheritance-deprecation"
      Puppet.puppet_deprecation_warning(msg, :key => "node-inheritance-#{names.join}", :file => context[:file], :line => context[:line])
    end

    @names = names
    @context = context
    @ruby_code = ruby_code
  end

  def instantiate(modname)
    @names.collect do |name|
      new_node = Puppet::Resource::Type.new(:node, name, @context.merge(:module_name => modname))
      new_node.ruby_code = @ruby_code if @ruby_code
      new_node
    end
  end
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
puppet-3.8.3 lib/puppet/parser/ast/node.rb
puppet-3.8.3-x86-mingw32 lib/puppet/parser/ast/node.rb
puppet-3.8.3-x64-mingw32 lib/puppet/parser/ast/node.rb
puppet-retrospec-0.8.0 vendor/gems/puppet-3.7.3/lib/puppet/parser/ast/node.rb
puppet-3.8.2 lib/puppet/parser/ast/node.rb
puppet-3.8.2-x86-mingw32 lib/puppet/parser/ast/node.rb
puppet-3.8.2-x64-mingw32 lib/puppet/parser/ast/node.rb
puppet-retrospec-0.7.3 vendor/gems/puppet-3.7.3/lib/puppet/parser/ast/node.rb
puppet-retrospec-0.7.2 vendor/gems/puppet-3.7.3/lib/puppet/parser/ast/node.rb
puppet-3.8.1 lib/puppet/parser/ast/node.rb
puppet-3.8.1-x86-mingw32 lib/puppet/parser/ast/node.rb
puppet-3.8.1-x64-mingw32 lib/puppet/parser/ast/node.rb
puppet-3.7.5 lib/puppet/parser/ast/node.rb
puppet-3.7.5-x86-mingw32 lib/puppet/parser/ast/node.rb
puppet-3.7.5-x64-mingw32 lib/puppet/parser/ast/node.rb
puppet-3.7.4 lib/puppet/parser/ast/node.rb
puppet-3.7.4-x86-mingw32 lib/puppet/parser/ast/node.rb
puppet-3.7.4-x64-mingw32 lib/puppet/parser/ast/node.rb
puppet-3.7.3 lib/puppet/parser/ast/node.rb
puppet-3.7.3-x86-mingw32 lib/puppet/parser/ast/node.rb