I could swear that at some point I had a define in init.pp and it worked. For some reason I could not reproduce that when I tried your example.
You might try two things:
1) on your puppet master, try applying site.pp
puppet apply --debug --modulepath /etc/puppet/modules /etc/puppet/manifests/site.pp
That might give you some hints in better error messages.
2) debug on both master and agent if the above works
Master:
su - -c /bin/bash puppet
puppet master --debug --no-daemonize
Agent:
puppet agent --debug --no-daemonize --onetime
Those might give you some better error messages at least.
On Sun, Jan 11, 2015 at 03:06:28PM -0800, Drew wrote:
> Thanks for jumping in. I've seen example modules from the forge that have
> the define in the init.pp. I'm pretty sure the module can have a define
> in it or a class. But I am doing something wrong for sure. I've already
> tried putting it in a different file and that didn't make any difference.
> On Saturday, January 10, 2015 at 8:39:13 AM UTC-5, Christopher Wood wrote:
>
> On Fri, Jan 09, 2015 at 01:51:28PM -0800, Drew wrote:
> > I'm fooling around with some defined types and am struggling a
> little.
> > The following is just a small example of what I'm doing while I
> work it
> > out:
> > #/etc/puppet/modules/testmodule/manifests/init.pp
> > define testmodule ( $message ){
> > testmodule::down { "${name}":
> > message => "test message for ${name}",
> > }
> > }
>
> I think init.pp has to contain only the class with the same name as the
> module.
>
> [1]
https://docs.puppetlabs.com/learning/modules1.html#module-structure
> [2]
https://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html#example
>
> You'd have to put the first define in another file is all.
>
> > #/etc/puppet/modules/testmodule/manifests/down.pp
> > define testmodule::down (
> > $message = "This is a test",
> > ){
> > notify { "$name":
> > message => "$message"
> > }
> > }
> > And I'm calling it like:
> > testmodule { "$filename":
> > message => $message,
> > }
>
> (You'll get other interesting errors if $filename is not defined
> anywhere.)
>
> > I have it included in my site.pp but I keep getting this:
> > Error: Could not retrieve catalog from remote server: Error 400 on
> SERVER:
> > Could not find class testmodule for [1][3]
puptest.domain.com on
> > node [2][4]
puptest.domain.com
> > Warning: Not using cache on failed catalog
> > Error: Could not retrieve catalog; skipping run
> > Google provides no solutions to this that I've been able to
> discover thus
> > far. Any help would be appreciated. I'm sure it's some lack of
> > understanding on my part.
> > Thanks!
>
> --
> 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 [5]
puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> [6]
https://groups.google.com/d/msgid/puppet-users/c8217b76-8628-4f44-9a95-b11ddc258f10%40googlegroups.com.
> For more options, visit [7]
https://groups.google.com/d/optout.
>
> References
>
> Visible links
> 1.
https://docs.puppetlabs.com/learning/modules1.html#module-structure
> 2.
https://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html#example
> 3.
http://puptest.domain.com/
> 4.
http://puptest.domain.com/
> 5. mailto:
puppet-users...@googlegroups.com
> 6.
https://groups.google.com/d/msgid/puppet-users/c8217b76-8628-4f44-9a95-b11ddc258f10%40googlegroups.com?utm_medium=email&utm_source=footer
> 7.
https://groups.google.com/d/optout