Not autloading custom functions

asked 2018-01-29 10:03:12 -0600

updated 2018-01-29 16:15:12 -0600

DarylW gravatar image


I'm trying to get my custom functions working but is having problems with it. would like to get some pointers how to troubleshoot the issue since my own searching doesn't help.

I'm writing a function using the Puppet Language. It's a very simple function but that's not the problem. I store the function in the functions-directory in my module. (which resides in the site-directory as recommended by the Roles and Profiles)

So. I have func.pp in module/functions/func.pp. Example:

function module::func($a,$b) {
... code ...

This does not work. The functions will not be found and I get the error "Unknown function". If I take my functions directory and store it in the environment directory it works. Without a problem. I get the same problem when I use the recommended path myenvironment/functions/environment/func.pp and function header environment::func().

Anyone have any ideas where to look? Where have I messed up?

edit retag flag offensive close merge delete


Err, maybe: If you place your function in one of the “global” directories, you just reference your function by `func()` (without `module::` in front of it). Only if your function is _part_ of a module, thus resides in the `my_great_module/functions/` directory, you have to prepend the module name.

Kai Burghardt gravatar imageKai Burghardt ( 2018-01-29 12:44:20 -0600 )edit

I did try that. But even if I create a my_great_module/functions/func.pp with my_great_module::func() it doesn't work. It still can't find the function. Tried to call it with func() and my_great_module::func() from my manifests. And the manifest is in the same module.

rogermartensson gravatar imagerogermartensson ( 2018-01-30 02:13:41 -0600 )edit