Issue #7218 has been updated by Ken Barber.

So the kwalify work is here:

<https://github.com/puppetlabs/puppetlabs-kwalify>

This provides a facility for validation using the kwalify JSON/structured data 
schema, which means we don't need to create our own. There are two methods for 
using it.

The 'kwalify' function takes a hash (which is the kwalify schema) and you pass 
it the hash returned by get_scope_args which creates a hash of all 
class/resource parameters.

The second methodology which is more intrusive is to use validate_resource 
which is more or less the same, but the schema sits alongside the class on the 
filesystem. So init.pp has a corresponding init.schema file (yaml) which has 
the kwalify schema stored in it.

Is this roughly what you were after Trevor?

The thread of discussion on this topic is here:

<http://groups.google.com/group/puppet-dev/browse_frm/thread/66890e2e06f1f50b/e0639a4269c69b9f?q=kwalify+puppet#e0639a4269c69b9f>
----------------------------------------
Feature #7218: Integrated variable checking for defines and parameterized 
classes.
https://projects.puppetlabs.com/issues/7218

Author: Trevor Vaughan
Status: Needs More Information
Priority: Low
Assignee: Ken Barber
Category: language
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


I would like the ability to, in the puppet language, check variables being 
passed to a class or define for validity.

This can currently be done by throwing a ParseError from a template, but that 
is quite syntactically heavy.

Current Case:

<pre>
define foo ( $bar ) {
  inline_template("<% if not ['true','false'].include?(bar) then raise 
Puppet::ParseError.new(\"$bar must be one of 'true', 'false'\")%>")
}
</pre>

Desired Case:

<pre>
define foo ( $bar, $baz ) {
  validate {
    bar => ['true','false'],
    baz => '/fancy regex'
  }
}
</pre>

Not critical, just would add some awesomeness.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to