Sha256: 5de24a3643ae690689d04b4251eb33c7e4164e3d8cc760e3d9d93b66479d70e8

Contents?: true

Size: 1.26 KB

Versions: 26

Compression:

Stored size: 1.26 KB

Contents

#
# module_array.rb
#
module Puppet::Parser::Functions
  newfunction(:module_array, :type => :rvalue, :doc => <<-EOS
This function performs a lookup for a variable value in various locations:
See: module_params()
If no value is found in the defined sources, it returns an empty array ([])
    EOS
) do |args|
    
    value = nil
    CORL.run do
      raise(Puppet::ParseError, "module_array(): Define at least the variable name " +
        "given (#{args.size} for 1)") if args.size < 1

      var_name = args[0]
      default  = ( args.size > 1 ? args[1] : [] )
      options  = ( args.size > 2 ? args[2] : {} )
      
      module_name = parent_module_name
      
      if module_name
        module_var_name = "#{module_name}::#{var_name}"
      
        config = CORL::Config.init(options, [ :param, :module_array, var_name ], module_name, {
          :provisioner     => :puppetnode,
          :hiera_scope     => self,
          :puppet_scope    => self,
          :search          => 'core::default',
          :search_name     => false,
          :force           => true,
          :merge           => true,
          :undefined_value => :undef
        })
        value = CORL::Config.lookup_array(module_var_name, default, config)
      end
    end
    return value
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
corl-0.4.29 lib/puppet/parser/functions/module_array.rb
corl-0.4.28 lib/puppet/parser/functions/module_array.rb
corl-0.4.27 lib/puppet/parser/functions/module_array.rb
corl-0.4.26 lib/puppet/parser/functions/module_array.rb
corl-0.4.25 lib/puppet/parser/functions/module_array.rb
corl-0.4.24 lib/puppet/parser/functions/module_array.rb
corl-0.4.23 lib/puppet/parser/functions/module_array.rb
corl-0.4.22 lib/puppet/parser/functions/module_array.rb
corl-0.4.21 lib/puppet/parser/functions/module_array.rb
corl-0.4.20 lib/puppet/parser/functions/module_array.rb
corl-0.4.19 lib/puppet/parser/functions/module_array.rb
corl-0.4.18 lib/puppet/parser/functions/module_array.rb
corl-0.4.17 lib/puppet/parser/functions/module_array.rb
corl-0.4.16 lib/puppet/parser/functions/module_array.rb
corl-0.4.15 lib/puppet/parser/functions/module_array.rb
corl-0.4.14 lib/puppet/parser/functions/module_array.rb
corl-0.4.13 lib/puppet/parser/functions/module_array.rb
corl-0.4.12 lib/puppet/parser/functions/module_array.rb
corl-0.4.11 lib/puppet/parser/functions/module_array.rb
corl-0.4.10 lib/puppet/parser/functions/module_array.rb