Peter Meier
2008-Feb-02 13:05 UTC
Service ensuring fails on some distro (gentoo) with some packages
Hi I''m having the following problem and tried already several workarounds, as well benp- tried to help me on irc. I copied the ntp modul from DavidS repo and adapted it in the Service part to run as well under openbsd. Which was just adding some binary if openbsd is the operatingsystem. However then I wanted to run it as well on a gentoo system (on centos, debian and openbsd it was working). But ensuring that the service is running within gentoo is always failing. If I start the init.d script manually and then rerun puppet, it works without any problem. Also with the original definition bei DavidS it won''t work under gentoo. The error I always get is: err: //Node[puppetmaster]/config/ntp::global/Service[ntpd]/ensure: change from stopped to running failed: Could not set running on ensure: undefined method `each'' for nil:NilClass at /var/lib/puppet/modules_src/ntp/manifests/init.pp:70 The definition of the service is: case $operatingsystem { openbsd: { service{ $ntp_service: binary => "/usr/sbin/ntpd", provider => base, pattern => ntpd, ensure => running, subscribe => [ File["/etc/ntp.conf"], File["/etc/ntp.client.conf"], File["/etc/ntp.server.conf"] ], } } default: { service{ $ntp_service: enable => true, ensure => running, subscribe => [ File["/etc/ntp.conf"], File["/etc/ntp.client.conf"], File["/etc/ntp.server.conf"] ], } } } (Sidequestion: I''m not very happy with describing some things twice. How could I avoid that?) In my opinion it looks like puppet is having some problem with the service/init.d-script(?) under gentoo and is getting therfor some nil-class. The debug output snippet is: debug: Calling fileserver.describe debug: Service[ntpd](provider=gentoo): Executing ''ps -ef'' debug: Puppet::Type::Service::ProviderGentoo: Executing ''/sbin/rc-update show'' debug: //Node[puppetmaster]/config/ntp::global/Service[ntpd]: Changing ensure debug: //Node[puppetmaster]/config/ntp::global/Service[ntpd]: 1 change(s) err: //Node[puppetmaster]/config/ntp::global/Service[ntpd]/ensure: change from stopped to running failed: Could not set running on ensure: undefined method `each'' for nil:NilClass at /var/lib/puppet/modules_src/ntp/manifests/init.pp:73 debug: Finishing transaction -609201138 with 2 changes debug: Storing state debug: Stored state in 0.11 seconds debug: Calling puppetreports.report any ideas what might be wrong? As a temporary workaround I can start the service on my own, however this is exactly what puppet should do for me ;) Thanks for any ideas and help! greets pete
David Schmitt
2008-Feb-04 11:08 UTC
Re: Service ensuring fails on some distro (gentoo) with some packages
Hi Pete! Peter Meier schrieb:> Hi > > I''m having the following problem and tried already several workarounds, > as well benp- tried to help me on irc. > > I copied the ntp modul from DavidS repo and adapted it in the Service > part to run as well under openbsd. Which was just adding some binary if > openbsd is the operatingsystem.Great to hear that the module is useful for people! Would you mind taking a look at http://git.black.co.at/?p=module-ntp;a=summary (which is also available as git://git.black.co.at/module-ntp) and sending my a bunch of patches against my current code?> However then I wanted to run it as well on a gentoo system (on centos, > debian and openbsd it was working). But ensuring that the service is > running within gentoo is always failing. If I start the init.d script > manually and then rerun puppet, it works without any problem. > > Also with the original definition bei DavidS it won''t work under gentoo. > > The error I always get is: > > err: //Node[puppetmaster]/config/ntp::global/Service[ntpd]/ensure: > change from stopped to running failed: Could not set running on ensure: > undefined method `each'' for nil:NilClass at > /var/lib/puppet/modules_src/ntp/manifests/init.pp:70Run puppetd with --trace to get a stacktrace. But from your description, I would suspect the gentoo service provider (if there is one).> The definition of the service is: > > case $operatingsystem { > openbsd: { > service{ $ntp_service: > binary => "/usr/sbin/ntpd", > provider => base, > pattern => ntpd, > ensure => running, > subscribe => [ File["/etc/ntp.conf"], > File["/etc/ntp.client.conf"], File["/etc/ntp.server.conf"] ], > } > } > default: { > service{ $ntp_service: > enable => true, > ensure => running, > subscribe => [ File["/etc/ntp.conf"], > File["/etc/ntp.client.conf"], File["/etc/ntp.server.conf"] ], > } > } > } > > (Sidequestion: I''m not very happy with describing some things twice. How > could I avoid that?)You can use inheritance within a single class: service { blah: ensure => running } case $operatingsystem { openbsd: { Service[blah]{ provider => base } } } Regards, DavidS
Luke Kanies
2008-Feb-04 23:34 UTC
Re: Service ensuring fails on some distro (gentoo) with some packages
On Feb 2, 2008, at 7:05 AM, Peter Meier wrote:> The debug output snippet is: > > debug: Calling fileserver.describe > debug: Service[ntpd](provider=gentoo): Executing ''ps -ef'' > debug: Puppet::Type::Service::ProviderGentoo: Executing ''/sbin/rc- > update > show'' > debug: //Node[puppetmaster]/config/ntp::global/Service[ntpd]: Changing > ensure > debug: //Node[puppetmaster]/config/ntp::global/Service[ntpd]: 1 > change(s) > err: //Node[puppetmaster]/config/ntp::global/Service[ntpd]/ensure: > change from stopped to running failed: Could not set running on > ensure: > undefined method `each'' for nil:NilClass at > /var/lib/puppet/modules_src/ntp/manifests/init.pp:73 > debug: Finishing transaction -609201138 with 2 changes > debug: Storing state > debug: Stored state in 0.11 seconds > debug: Calling puppetreports.report > > any ideas what might be wrong? > > As a temporary workaround I can start the service on my own, however > this is exactly what puppet should do for me ;)Can you provide a stack trace, by running the client with --trace? -- Death and taxes are inevitable; at least death doesn''t get worse every year. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
peter.meier@immerda.ch
2008-Feb-05 13:48 UTC
Re: Service ensuring fails on some distro (gentoo) with some packages
Hi> Can you provide a stack trace, by running the client with --trace?voilĂ : -- notice: //Modules_dir[munin/nodes]/File[/var/lib/puppet/modules/munin/nodes]/checksum: checksum changed ''{time}Sat Feb 02 00:05:35 +0100 2008'' to ''{time}Tue Feb 05 14:46:19 +0100 2008'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/init.rb:75:in `search'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/init.rb:61:in `initscript'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/init.rb:106:in `startcmd'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:132:in `send'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:132:in `ucommand'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:78:in `start'' /usr/lib/ruby/site_ruby/1.8/puppet/type/service.rb:59:in `set_running'' /usr/lib/ruby/site_ruby/1.8/puppet/property.rb:164:in `send'' /usr/lib/ruby/site_ruby/1.8/puppet/property.rb:164:in `call_valuemethod'' /usr/lib/ruby/site_ruby/1.8/puppet/property.rb:350:in `set'' /usr/lib/ruby/site_ruby/1.8/puppet/property.rb:422:in `sync'' /usr/lib/ruby/site_ruby/1.8/puppet/type/service.rb:70:in `sync'' /usr/lib/ruby/site_ruby/1.8/puppet/propertychange.rb:81:in `go'' /usr/lib/ruby/site_ruby/1.8/puppet/propertychange.rb:109:in `forward'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:119:in `apply_changes'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:111:in `collect'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:111:in `apply_changes'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:83:in `apply'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:240:in `eval_resource'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:444:in `thinmark'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:443:in `thinmark'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:239:in `eval_resource'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:311:in `evaluate'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:444:in `thinmark'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:443:in `thinmark'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:310:in `evaluate'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:304:in `collect'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:304:in `evaluate'' /usr/lib/ruby/site_ruby/1.8/puppet/node/catalog.rb:102:in `apply'' /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:260:in `run'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:212:in `benchmark'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:211:in `benchmark'' /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:259:in `run'' /usr/lib/ruby/1.8/sync.rb:229:in `synchronize'' /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:241:in `run'' /usr/bin/puppetd:429 /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/init.rb:75:in `search'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/init.rb:61:in `initscript'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/init.rb:106:in `startcmd'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:132:in `send'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:132:in `ucommand'' /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/base.rb:78:in `start'' /usr/lib/ruby/site_ruby/1.8/puppet/type/service.rb:59:in `set_running'' /usr/lib/ruby/site_ruby/1.8/puppet/property.rb:164:in `send'' /usr/lib/ruby/site_ruby/1.8/puppet/property.rb:164:in `call_valuemethod'' /usr/lib/ruby/site_ruby/1.8/puppet/property.rb:350:in `set'' /usr/lib/ruby/site_ruby/1.8/puppet/property.rb:422:in `sync'' /usr/lib/ruby/site_ruby/1.8/puppet/type/service.rb:70:in `sync'' /usr/lib/ruby/site_ruby/1.8/puppet/propertychange.rb:81:in `go'' /usr/lib/ruby/site_ruby/1.8/puppet/propertychange.rb:109:in `forward'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:119:in `apply_changes'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:111:in `collect'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:111:in `apply_changes'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:83:in `apply'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:240:in `eval_resource'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:444:in `thinmark'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:443:in `thinmark'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:239:in `eval_resource'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:311:in `evaluate'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:444:in `thinmark'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:443:in `thinmark'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:310:in `evaluate'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:304:in `collect'' /usr/lib/ruby/site_ruby/1.8/puppet/transaction.rb:304:in `evaluate'' /usr/lib/ruby/site_ruby/1.8/puppet/node/catalog.rb:102:in `apply'' /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:260:in `run'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:212:in `benchmark'' /usr/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/lib/ruby/1.8/benchmark.rb:307:in `realtime'' /usr/lib/ruby/site_ruby/1.8/puppet/util.rb:211:in `benchmark'' /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:259:in `run'' /usr/lib/ruby/1.8/sync.rb:229:in `synchronize'' /usr/lib/ruby/site_ruby/1.8/puppet/network/client/master.rb:241:in `run'' /usr/bin/puppetd:429 err: //Node[puppet.glei.ch]/config/ntp::global/Service[ntpd]/ensure: change from stopped to running failed: Could not set running on ensure: undefined method `each'' for nil:NilClass at /var/lib/puppet/modules_src/ntp/manifests/init.pp:73 info: Sent transaction report in 0.08 seconds -- greets pete
Luke Kanies
2008-Feb-06 16:50 UTC
Re: Service ensuring fails on some distro (gentoo) with some packages
On Feb 5, 2008, at 7:48 AM, peter.meier@immerda.ch wrote:> Hi > >> Can you provide a stack trace, by running the client with --trace? > > voilĂ : > > -- > notice: > //Modules_dir[munin/nodes]/File[/var/lib/puppet/modules/munin/nodes]/ > checksum: > checksum changed ''{time}Sat Feb 02 00:05:35 +0100 2008'' to ''{time}Tue > Feb 05 14:46:19 +0100 2008'' > /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/init.rb:75:in > `search'' > /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/init.rb:61:in > `initscript'' > /usr/lib/ruby/site_ruby/1.8/puppet/provider/service/init.rb:106:in > `startcmd''Could you file a bug with this stack trace and the code plus environment and versions that exhibit the problem? Do all systems of that type have the problem? All services? -- Millions long for immortality who do not know what to do with themselves on a rainy Sunday afternoon. -- Susan Ertz --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
Peter Meier
2008-Feb-07 10:49 UTC
Re: Service ensuring fails on some distro (gentoo) with some packages
Hi> Could you file a bug with this stack trace and the code plus > environment and versions that exhibit the problem? > > Do all systems of that type have the problem? All services?I debugged the problem a bit more and figured out that any not yet running service on gentoo fails to be started. As well I found the solution for the problem and attached a patch to fix the problem. http://reductivelabs.com/trac/puppet/ticket/1052 I hope this fix will get into 0.24.2, which is afair coming soon?! However I''ll make as well a bug report on gentoo so they might fix it already in their 0.24.1 release. greets pete