Puppet Function: psick::contain_classes

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

Overview

psick::contain_classes(Variant[Hash,Array,String] $classes, Optional[String] $dependency = undef)Any

Parameters:

  • classes (Variant[Hash,Array,String])
  • dependency (Optional[String]) (defaults to: undef)

Returns:

  • (Any)


1
2
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
29
30
31
32
33
34
# File 'functions/contain_classes.pp', line 1

function psick::contain_classes(Variant[Hash,Array,String] $classes,
Optional[String] $dependency = undef) {
  case $classes {
    Array: {
      $classes.each |$c| {
        if $c != '' {
          contain $c
          if $dependency {
            Class[$dependency] -> Class[$c]
          }
        }
      }
    }
    Hash: {
      $classes.each |$n,$c| {
        if $c != '' {
          contain $c
          if $dependency {
            Class[$dependency] -> Class[$c]
          }
        }
      }
    }
    String: {
      if $classes != '' {
        contain $classes
        if $dependency {
          Class[$dependency] -> Class[$classes]
        }
      }
    }
    default: {}
  }
}