Sha256: 54287a103e6035ba4ee860bd3cf736cf44ff1c410d469fdd5eccdb8be60308da
Contents?: true
Size: 970 Bytes
Versions: 20
Compression:
Stored size: 970 Bytes
Contents
# Test whether a given class or definition is defined require 'puppet/parser/functions' Puppet::Parser::Functions.newfunction(:concat_getparam, :type => :rvalue, :doc => <<-'ENDOFDOC' Takes a resource reference and name of the parameter and returns value of resource's parameter. *Examples:* define example_resource($param) { } example_resource { "example_resource_instance": param => "param_value" } concat_getparam(Example_resource["example_resource_instance"], "param") Would return: param_value ENDOFDOC ) do |vals| reference, param = vals raise(ArgumentError, 'Must specify a reference') unless reference raise(ArgumentError, 'Must specify name of a parameter') unless param and param.instance_of? String return '' if param.empty? if resource = findresource(reference.to_s) return resource[param] if resource[param] end return '' end
Version data entries
20 entries across 20 versions & 1 rubygems