Puppet Function: get_magicvar
- Defined in:
- lib/puppet/parser/functions/get_magicvar.rb
- Function type:
- Ruby 3.x API
Overview
This returns the value of the input variable. For example if you input role it returns the value of $role’.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/puppet/parser/functions/get_magicvar.rb', line 7 newfunction(:get_magicvar, :type => :rvalue, :doc => <<-EOS This returns the value of the input variable. For example if you input role it returns the value of $role'. EOS ) do |arguments| raise(Puppet::ParseError, 'get_magicvar(): Wrong number of arguments ' + "given (#{arguments.size} for 1)") if arguments.size < 1 my_var = arguments[0] result = lookupvar("#{my_var}") result = 'all' if (result == :undefined || result == '') return result end |