blob: 68e559ea6d4d3ab424e44d045e85109f84342969 (
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
47
48
|
## puppetlabs-functions module
### Overview
This is the puppet-functions module. Here we are providing a library of various functions that extend the basic function library that is provided in Puppet.
### Disclaimer
Warning! While this software is written in the best interest of quality it has not been formally tested by our QA teams. Use at your own risk, but feel free to enjoy and perhaps improve it while you do.
Please see the included Apache Software License for more legal details regarding warranty.
### Installation
From github, download the module into your modulepath on your Puppetmaster. If you are not sure where your module path is try this command:
puppet --configprint modulepath
Depending on the version of Puppet, you may need to restart the puppetmasterd (or Apache) process before the functions will work.
## Functions
### kwalify
This function allows you to validate Puppet data structures using Kwalify
schemas as documented here:
http://www.kuwata-lab.com/kwalify/ruby/users-guide.01.html
To validate, create a schema in Puppet:
$schema = {
'type' => 'seq',
'sequence' => [
{ 'type' => 'str' }
]
}
And create some content that you want validated:
$document = ['a', 'b', 'c']
And then use the function to validate:
kwalify($schema, $document)
The function will throw an error and list all validation errors if there is a
problem otherwise it succeeds silently.
|