Puppet Function: tp::create_everything

Defined in:
functions/create_everything.pp
Function type:
Puppet Language

Overview

tp::create_everything(Hash $resources = {}, Hash $resources_defaults = {})Any

Function tp::create_everything. Gets an hash of resource types and creates the relevant resources

Parameters:

  • resources (Hash) (defaults to: {})
  • resources_defaults (Hash) (defaults to: {})

Returns:

  • (Any)


3
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
# File 'functions/create_everything.pp', line 3

function tp::create_everything (
  Hash $resources = {},
  Hash $resources_defaults = {},
) {
  $resources.each |$resource,$params| {
    case $params {
      Hash: {
        $params.each |$kk,$vv| {
          create_resources($resource, { $kk => {} }, pick(getvar("resources_defaults.${resource}"), $resources_defaults) + $vv)
        }
      }
      Array: {
        create_resources($resource, { $params.unique => {} }, pick(getvar("resources_defaults.${resource}"), $resources_defaults))
      }
      String: {
        create_resources($resource, { $params => {} }, pick(getvar("resources_defaults.${resource}"), $resources_defaults))
      }
      Undef: {
        # do nothing
      }
      default: {
        fail("Unsupported type for ${resource_data}. Valid types are String, Array, Hash, Undef.")
      }
    }
  }
}