Re: [Puppet Users] defined types question

2015-01-12 Thread Drew
Damn!  That was it.  Removed my include and it works exactly like it should.

On Sunday, January 11, 2015 at 6:46:20 PM UTC-5, Felix.Frank wrote:
>
> On 01/10/2015 02:39 PM, 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. 
>
> Kind of like that, but backwards :-) 
>
> The class 'testmodule' must reside in init.pp. Any class or define *can* 
> be put there and the autoloader will find it all right. But it is better 
> practice to put everything in their own respective files. 
>
> The issue here is likely that the OP tries to `include testmodule` even 
> though there is no such class. Just get rid of this include statement - 
> instantiating your define will Just Work. 
>
> HTH, 
> Felix 
>

-- 
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/6cff5e79-0fa9-4128-b6fe-814100cbd4b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] defined types question

2015-01-12 Thread Drew
Thanks, Felix.

On Monday, January 12, 2015 at 7:57:05 AM UTC-5, Drew wrote:
>
> Damn!  That was it.  Removed my include and it works exactly like it 
> should.
>
> On Sunday, January 11, 2015 at 6:46:20 PM UTC-5, Felix.Frank wrote:
>>
>> On 01/10/2015 02:39 PM, 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. 
>>
>> Kind of like that, but backwards :-) 
>>
>> The class 'testmodule' must reside in init.pp. Any class or define *can* 
>> be put there and the autoloader will find it all right. But it is better 
>> practice to put everything in their own respective files. 
>>
>> The issue here is likely that the OP tries to `include testmodule` even 
>> though there is no such class. Just get rid of this include statement - 
>> instantiating your define will Just Work. 
>>
>> HTH, 
>> Felix 
>>
>

-- 
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/29080351-71fa-4956-9ce6-0fb999deaf78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] defined types question

2015-01-11 Thread Felix Frank
On 01/10/2015 02:39 PM, 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.

Kind of like that, but backwards :-)

The class 'testmodule' must reside in init.pp. Any class or define *can*
be put there and the autoloader will find it all right. But it is better
practice to put everything in their own respective files.

The issue here is likely that the OP tries to `include testmodule` even
though there is no such class. Just get rid of this include statement -
instantiating your define will Just Work.

HTH,
Felix

-- 
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/54B30B40.5010309%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] defined types question

2015-01-11 Thread Christopher Wood
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+unsubscr...@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+unsubscr...@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

-- 
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/20150111233100.GA20005%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] defined types question

2015-01-11 Thread Drew
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. 
>
> https://docs.puppetlabs.com/learning/modules1.html#module-structure 
>
> 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]puptest.domain.com on 
> >node [2]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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/c8217b76-8628-4f44-9a95-b11ddc258f10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] defined types question

2015-01-10 Thread Christopher Wood
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.

https://docs.puppetlabs.com/learning/modules1.html#module-structure
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]puptest.domain.com on
>node [2]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 [3]puppet-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>
> [4]https://groups.google.com/d/msgid/puppet-users/7b9505ce-1383-42ff-8f00-e28e86353000%40googlegroups.com.
>For more options, visit [5]https://groups.google.com/d/optout.
> 
> References
> 
>Visible links
>1. http://puptest.ironmountain.com/
>2. http://puptest.ironmountain.com/
>3. mailto:puppet-users+unsubscr...@googlegroups.com
>4. 
> https://groups.google.com/d/msgid/puppet-users/7b9505ce-1383-42ff-8f00-e28e86353000%40googlegroups.com?utm_medium=email&utm_source=footer
>5. https://groups.google.com/d/optout

-- 
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/20150110133900.GA32604%40iniquitous.heresiarch.ca.
For more options, visit https://groups.google.com/d/optout.