Sha256: 59ac06c9db6beb35e9fa11e0769edd52d6e99d2451b8e40c229263b7c2b95099

Contents?: true

Size: 1.07 KB

Versions: 24

Compression:

Stored size: 1.07 KB

Contents

# Include the specified classes
# For documentation see the 3.x stub
Puppet::Functions.create_function(:include, Puppet::Functions::InternalFunction) do
  dispatch :include do
    scope_param
    # The function supports what the type system sees as Ruby runtime objects, and
    # they cannot be parameterized to find what is actually valid instances.
    # The validation is instead done in the function body itself via a call to
    # `transform_and_assert_classnames` on the calling scope.
    required_repeated_param 'Any', :names
  end

  def include(scope, *classes)
    if Puppet[:tasks]
      raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
        Puppet::Pops::Issues::CATALOG_OPERATION_NOT_SUPPORTED_WHEN_SCRIPTING,
        {:operation => 'include'})
    end

    classes = scope.transform_and_assert_classnames(classes.flatten)
    result = classes.map {|name| Puppet::Pops::Types::TypeFactory.host_class(name) }
    scope.compiler.evaluate_classes(classes, scope, false)

    # Result is an Array[Class, 1, n] which allows chaining other operations
    result
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
bolt-0.17.1 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.17.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.16.4 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.16.3 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.16.2 vendored/puppet/lib/puppet/functions/include.rb
puppet-5.4.0 lib/puppet/functions/include.rb
puppet-5.4.0-x86-mingw32 lib/puppet/functions/include.rb
puppet-5.4.0-x64-mingw32 lib/puppet/functions/include.rb
puppet-5.4.0-universal-darwin lib/puppet/functions/include.rb
bolt-0.16.1 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.16.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.15.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.14.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.13.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.12.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.11.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.10.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.9.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.8.0 vendored/puppet/lib/puppet/functions/include.rb
bolt-0.7.0 vendored/puppet/lib/puppet/functions/include.rb