Hi,

I'm learning Puppet 4 and especially the Puppet 4 API for custom
functions and "data binding" in modules. Currently, my sources are:

-
http://puppet-on-the-edge.blogspot.fr/2015/01/puppet-40-data-in-modules-and.html
-
http://puppet-on-the-edge.blogspot.be/2015/02/puppet-40-data-in-modules-part-ii.html
-
https://github.com/puppetlabs/puppet-specifications/blob/master/language/func-api.md#function-api

But I have questions yet. ;)

1. About the "data binding" in a modules, if I understand well the
`./mymodule/lib/puppet/functions/mymodule/data.rb` function replaces
completely the "params" pattern, so that the "params" pattern is
completely useless in a module using the Puppet 4 API. Is is correct?

2. Always about the "data binding" in a modules, is it correct to say
that the `data.rb` function replaces too the default values in the
declaration of a class? For instance with:

class mymodule (
  $param1 = 'default1',
  $param2 = 'default2',
) {
  ...
}

I can remove the default values in the class and put it in the `data.rb`
function. Is it correct?

3. In a module, if I have 2 public classes foo.pp and bar.pp, is it
possible to have 2 different `data.rb` functions, one for foo.pp and one
for bar.pp? Or maybe I can have only one `data.rb` function which
provides simultaneously the default values for foo.pp *and* bar.pp?

4. In a custom function with the Puppet 4 API, in the `dispatch` method,
is it possible to provide more complex types than 'Array' or 'String',
for instance is it possible to provide types like "an array of strings"
or "an non empty array of non empty string"?

5. In a custom function with the Puppet 4 API, is it possible to get the
value of a variable in a module or of a fact? With the Puppet 3 API,
it's possible with `lookupvar('xxx')` but it works no longer with the
Puppet 4 API.

6. In a custom function with Puppet 4 API, what is the difference between:

   call_function(:fail, "Error, blabla blabla")

and

    call_function("fail", "Error, blabla blabla") ?

That's all. ;)
Thanks in advance for your help.

--
François Lafont

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/5579C443.7050203%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to