Puppet Function: tp_install
- Defined in:
- lib/puppet/parser/functions/tp_install.rb
- Function type:
- Ruby 3.x API
Overview
Takes the application title and an optional list of parameters. It declares a tp::install with the given title and parameters. This function can be called used multiple times with the same application title. If parameters are used, then you may have a Duplicate declaration: Tp::Install error. In such cases try to have the tp_install function with parameters being parsed before the other occurences.
The first argument can be an array of applications to install.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/puppet/parser/functions/tp_install.rb', line 4 Puppet::Parser::Functions.newfunction(:tp_install, :type => :statement, :doc => <<-'ENDOFDOC' Takes the application title and an optional list of parameters. It declares a tp::install with the given title and parameters. This function can be called used multiple times with the same application title. If parameters are used, then you may have a Duplicate declaration: Tp::Install[$app] error. In such cases try to have the tp_install function with parameters being parsed before the other occurences. The first argument can be an array of applications to install. ENDOFDOC ) do |vals| title, params = vals raise(ArgumentError, 'Must specify an application name') unless title params ||= {} items = [title].flatten items.each do |item| Puppet::Parser::Functions.function(:defined_with_params) if function_defined_with_params(["tp::install[#{item}]", params]) Puppet.debug("Resource tp::install[#{item}] with params #{params} not created because it already exists") else Puppet.debug("Created new resource tp::install[#{item}] with params #{params}") Puppet::Parser::Functions.function(:create_resources) function_create_resources(['Tp::Install', { item => params }]) end end end |