On Tue, Nov 8, 2011 at 6:31 AM, Marc Richman <
[email protected]> wrote:
> I have a function defined in one class that I would like to use in another
> class, but I can not seem to get it to work, I set up a simple test case
> and I get the following error:
> Could not retrieve catalog from remote server: Error 400 on SERVER:
> Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid
> resource type testfn at /etc/puppet/modules/sandbox/one/manifests/init.pp:3
> on node bos-test01.contentstore.net
>
>
> /etc/puppet/modules/sandbox/one/manifests/init.pp
> class one {
> include two
> testfn { test:}
> }
>
> /etc/puppet/modules/sandbox/two/manifests/init.pp
> class two {
> define testfn () {
> notify {foo: }
> }
> }
>
> What am I doing wrong?
>
This isn't a function. It's a defined type. Functions are a different thing
in Puppet.
Put the define in a place the autoloader will find it. I'm assuming your
modulepath is "/etc/puppet/modules/sandbox" ?
/etc/puppet/modules/sandbox/two/manifests/testfn.pp
define two::testfn() { ... }
then you can declare instances of it from anywhere.
>
> Thanks
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" 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-users?hl=en.
>
>
--
Nigel Kersten
Product Manager, Puppet Labs
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" 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-users?hl=en.