No description
Find a file
2011-07-29 21:17:19 +01:00
examples Added validate_resource function and examples on how to use it (and kwalify as well) 2011-07-01 21:09:02 +02:00
lib/puppet/parser/functions Removed date stub since this functinality is available in strftime anyway. 2011-07-29 20:56:40 +01:00
spec Some improvements to values_at tests. 2011-07-29 21:17:19 +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.