summaryrefslogtreecommitdiff
path: root/README.markdown
blob: 4761f9d865453e3fcaedeabf1a4c7900c84d4b76 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
# Standard Library-- #

[![Build Status](https://travis-ci.org/agx/puppet-stdlibmm.png?branch=master)](https://travis-ci.org/agx/puppet-stdlibmm)

This puppet module provides some function on top of the standard library. It's
called "stdlib minus minus".

# Functions #

validate_nonemptystring
-----------------------
Validate that all passed values are strings with a length greater 0
and not undef. Abort catalog compilation if any value fails this
check.

The following values will pass:

    $my_string = "one two"
    validate_nonemptystring($my_string, 'three')

The following values will fail, causing compilation to abort:

    validate_nonemptystring(true)
    validate_nonemptystring([ 'some', 'array' ])
    $undefined = undef
    validate_nonemptystring($undefined)

validate_nonemptyarray
----------------------
Validate that all passed values are array data structures. Abort
catalog compilation if any value fails this check. Also abort if any
of the arrays is empty.

The following values will pass:

    $my_array = [ 'one', 'two' ]
    validate_nonemptyarray($my_array)

The following values will fail, causing compilation to abort:

    validate_nonemptyarray(true)
    validate_nonemptyarray([])
    validate_nonemptyarray('some_string')
    $undefined = undef
    validate_nonemptyarray($undefined)