Sha256: 1e9b5bb4b5c8e29591ee7e36e6462d4cab172c972852be17580e16baf2c704a8

Contents?: true

Size: 1.61 KB

Versions: 515

Compression:

Stored size: 1.61 KB

Contents

# Requires the specified classes

  Puppet::Parser::Functions::newfunction(
    :require,
    :arity => -2,
    :doc =>"Evaluate one or more classes,  adding the required class as a dependency.

The relationship metaparameters work well for specifying relationships
between individual resources, but they can be clumsy for specifying
relationships between classes.  This function is a superset of the
'include' function, adding a class relationship so that the requiring
class depends on the required class.

Warning: using require in place of include can lead to unwanted dependency cycles.

For instance the following manifest, with 'require' instead of 'include' would produce a nasty dependence cycle, because notify imposes a before between File[/foo] and Service[foo]:

    class myservice {
      service { foo: ensure => running }
    }

    class otherstuff {
      include myservice
      file { '/foo': notify => Service[foo] }
    }

Note that this function only works with clients 0.25 and later, and it will
fail if used with earlier clients.

You must use the class's full name;
relative names are not allowed. In addition to names in string form,
you may also directly use Class and Resource Type values that are produced when evaluating
resource and relationship expressions.

- Since 4.0.0 Class and Resource types, absolute names
- Since 4.7.0 Returns an Array[Type[Class]] with references to the required classes
") do |classes|
  call_function('require', classes)
  Puppet.warn_once('deprecations', '3xfunction#require', _("Calling function_require via the Scope class is deprecated. Use Scope#call_function instead"))
end

Version data entries

515 entries across 515 versions & 2 rubygems

Version Path
puppet-7.34.0 lib/puppet/parser/functions/require.rb
puppet-7.34.0-x86-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.34.0-x64-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.34.0-universal-darwin lib/puppet/parser/functions/require.rb
puppet-7.33.0 lib/puppet/parser/functions/require.rb
puppet-7.33.0-x86-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.33.0-x64-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.33.0-universal-darwin lib/puppet/parser/functions/require.rb
puppet-7.32.1 lib/puppet/parser/functions/require.rb
puppet-7.32.1-x86-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.32.1-x64-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.32.1-universal-darwin lib/puppet/parser/functions/require.rb
puppet-7.31.0 lib/puppet/parser/functions/require.rb
puppet-7.31.0-x86-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.31.0-x64-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.31.0-universal-darwin lib/puppet/parser/functions/require.rb
puppet-7.30.0 lib/puppet/parser/functions/require.rb
puppet-7.30.0-x86-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.30.0-x64-mingw32 lib/puppet/parser/functions/require.rb
puppet-7.30.0-universal-darwin lib/puppet/parser/functions/require.rb