No description
Find a file
2011-06-29 23:39:23 +01:00
lib/puppet/parser/functions Move require inside function for kwalify. 2011-06-29 23:39:23 +01:00
spec Add some more functional tests. 2011-06-29 23:37:37 +01:00
.gitignore Added tests for each function, fixing functions as we hit bugs. 2011-06-29 21:21:55 +01:00
LICENSE Added Apache license. 2011-04-30 15:59:31 +02:00
Modulefile Rename to puppetlabs-functions. 2011-05-16 21:40:01 +01:00
Rakefile Copied function test scaffolding from puppet. 2011-06-29 12:25:43 +01:00
README.markdown Added kwalify function. 2011-06-29 12:30:07 +01:00

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.