Hello
So i have tried to write my first custom module, its to config snmp
and have different snmpd.conf depening on where the server is placed
(different offices etc) I just cant get it to work all the way, i get
this error:
err: Could not retrieve catalog from remote server: Error 400 on
SERVER: Could not find class snmpd for wiki.chicago.local at /etc/
puppet/manifests/nodes/wiki.chicago.local.pp:3 on node
wiki.chicago.local.
On the puppet server i have the stuff placed at: /etc/puppet/modules/
snmpd/manifests
The init.pp looks like this:
class snmpd::install {
package { "net-snmpd":
ensure => present,
}
class snmpd {
include snmpd::install, snmpd::service
}
define snmpd::type($placement) {
include snmpd
file { "/etc/snmp/snmpd.conf":
owner => "root",
group => "root",
mode => 640,
source => "puppet:///snmp/snmpd-($placement).conf",
require => Class["snmpd::install"],
}
And on the node that getting the error message i have include snmpd.
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
On 12-01-07 12:55 PM, Ola wrote:> On the puppet server i have the stuff placed at: /etc/puppet/modules/ > snmpd/manifests > The init.pp looks like this:hmm it mostly looks okay, but I don''t know if it was a typing mistake when copying or if you really copy-pasted from your file, but:> class snmpd::install { > package { "net-snmpd": > ensure => present, > } >you''re missing a } here> > > class snmpd { > include snmpd::install, snmpd::service > > > > } > > define snmpd::type($placement) { > > include snmpd > > file { "/etc/snmp/snmpd.conf": > > owner => "root", > group => "root", > mode => 640, > source => "puppet:///snmp/snmpd-($placement).conf", > require => Class["snmpd::install"], > }and another } here> And on the node that getting the error message i have include snmpd.If the above is true though, I would expect puppet to fail with a syntax error instead of saying that it can''t find the class. You can check your init.pp file for syntax with the command: puppet --parseonly --ignoreimport /etc/puppet/modules/snmpd/manifests/init.pp -- Gabriel Filion -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Sat, Jan 7, 2012 at 6:14 PM, Gabriel Filion You can check your init.pp file for syntax with the command:> > puppet --parseonly --ignoreimport > /etc/puppet/modules/snmpd/manifests/init.pp >Be advised that in recent puppet, --ignoreimport will in fact ignore the entire file and return true even on syntax errors. See: http://projects.puppetlabs.com/issues/9670 for all the details. -- Zac Sprackett, Director of Network Operations SugarCRM, Inc. w: http://sugarcrm.com e: zac@sugarcrm.com t: +1.613.265.0860 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On 8 Jan, 00:14, Gabriel Filion <lelu...@gmail.com> wrote:> On 12-01-07 12:55 PM, Ola wrote: > > > On the puppet server i have the stuff placed at: /etc/puppet/modules/ > > snmpd/manifests > > The init.pp looks like this: > > hmm it mostly looks okay, but I don''t know if it was a typing mistake > when copying or if you really copy-pasted from your file, but: > > > class snmpd::install { > > package { "net-snmpd": > > ensure => present, > > } > > you''re missing a } hereThank you, this did the trick.> > > > > > > > > > > > > class snmpd { > > include snmpd::install, snmpd::service > > > } > > > define snmpd::type($placement) { > > > include snmpd > > > file { "/etc/snmp/snmpd.conf": > > > owner => "root", > > group => "root", > > mode => 640, > > source => "puppet:///snmp/snmpd-($placement).conf", > > require => Class["snmpd::install"], > > } > > and another } here > > > And on the node that getting the error message i have include snmpd. > > If the above is true though, I would expect puppet to fail with a syntax > error instead of saying that it can''t find the class. > > You can check your init.pp file for syntax with the command: > > puppet --parseonly --ignoreimport > /etc/puppet/modules/snmpd/manifests/init.pp > > -- > Gabriel Filion-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
With regards to this line:
source => "puppet:///snmp/snmpd-($placement).conf",
I have two minor suggestions. First, it''s probably neater to do this:
source => "puppet:///snmp/snmpd-${placement}.conf",
And then, for $placement = ''foo'', the file would be:
modules/snmp/files/placement-foo.conf
Also, for the path, you should be specifying the modules directory
since the way you''re currently specifying the source is deprecated:
source => "puppet:///modules/snmp/snmpd-${placement}.conf",
On Jan 8, 1:25 am, Ola <anton.loth...@gmail.com>
wrote:> On 8 Jan, 00:14, Gabriel Filion <lelu...@gmail.com> wrote:> On
12-01-07 12:55 PM, Ola wrote:
>
> > > On the puppet server i have the stuff placed at:
/etc/puppet/modules/
> > > snmpd/manifests
> > > The init.pp looks like this:
>
> > hmm it mostly looks okay, but I don''t know if it was a typing
mistake
> > when copying or if you really copy-pasted from your file, but:
>
> > > class snmpd::install {
> > > package { "net-snmpd":
> > > ensure => present,
> > > }
>
> > you''re missing a } here
>
> Thank you, this did the trick.
>
>
>
>
>
>
>
>
>
> > > class snmpd {
> > > include snmpd::install, snmpd::service
>
> > > }
>
> > > define snmpd::type($placement) {
>
> > > include snmpd
>
> > > file { "/etc/snmp/snmpd.conf":
>
> > > owner => "root",
> > > group => "root",
> > > mode => 640,
> > > source =>
"puppet:///snmp/snmpd-($placement).conf",
> > > require => Class["snmpd::install"],
> > > }
>
> > and another } here
>
> > > And on the node that getting the error message i have include
snmpd.
>
> > If the above is true though, I would expect puppet to fail with a
syntax
> > error instead of saying that it can''t find the class.
>
> > You can check your init.pp file for syntax with the command:
>
> > puppet --parseonly --ignoreimport
> > /etc/puppet/modules/snmpd/manifests/init.pp
>
> > --
> > Gabriel Filion
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.