Issue #2887 has been updated by Markus Roberts. Assigned to changed from Markus Roberts to Jesse Wolfe Target version set to Puppet - 0.25.3
---------------------------------------- Bug #2887: Service (init) does not seem to work with require properly http://projects.reductivelabs.com/issues/2887 Author: Erik Hetzner Status: Investigating Priority: Normal Assigned to: Jesse Wolfe Category: Target version: 0.25.3 Affected version: 0.25.1 Keywords: Branch: Hi - I have puppet manifest which manage init scripts. When running in stand-alone mode (& perhaps in client/server mode), I have trouble with the following manifest: <pre> file { "/tmp/init.d" : ensure => directory; "/tmp/init.d/test" : mode => "0755", content => "#!/bin/sh case \"\$1\" in start) exit 0 ;; stop) exit 0 ;; restart) exit 0 ;; status) exit 3 ;; *) echo \"Usage: $0 {start|stop|restart|status}\" exit 1 ;; esac"; } service { "test" : ensure => "running", provider => "init", path => "/tmp/init.d", require => File[ "/tmp/init.d/test" ], hasstatus => true; } #exec { "test" : # command => "/usr/bin/test -f /tmp/init.d/test", # require => File[ "/tmp/init.d/test" ]; #} </pre> Although I would expect this to create the /tmp/init.d directory, then the /tmp/init.d/test file, and finally start the service, it seems to try to start the service before it creates the /tmp/init.d/test file: <pre> $ /var/lib/gems/1.8/bin/puppet --trace --verbose --debug test.pp debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not exist debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not exist debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig does not exist debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svstat does not exist debug: /Service[test]: Search path /tmp/init.d does not exist debug: Creating default schedules debug: Finishing transaction 69902193692440 with 0 changes debug: /Service[test]/require: requires File[/tmp/init.d/test] debug: Failed to load library 'shadow' for feature 'libshadow' debug: Failed to load library 'ldap' for feature 'ldap' debug: //File[/tmp/init.d/test]: Autorequiring File[/tmp/init.d] info: Applying configuration version '1259890767' debug: //File[/tmp/init.d]: Changing ensure debug: //File[/tmp/init.d]: 1 change(s) notice: //File[/tmp/init.d]/ensure: created debug: //File[/tmp/init.d/test]: Changing content,mode debug: //File[/tmp/init.d/test]: 2 change(s) notice: //File[/tmp/init.d/test]/content: defined content as 'unknown checksum' notice: //File[/tmp/init.d/test]/mode: defined 'mode' as '755' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/provider/service/init.rb:100:in `search' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/provider/service/init.rb:70:in `initscript' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/provider/service/init.rb:121:in `statuscmd' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/provider/service/base.rb:62:in `status' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/type/service.rb:68:in `retrieve' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/type.rb:804:in `currentpropvalues' /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `inject' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/type.rb:802:in `each' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/type.rb:802:in `inject' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/type.rb:802:in `currentpropvalues' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/type.rb:790:in `retrieve' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/type.rb:719:in `evaluate' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/transaction.rb:60:in `apply' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/transaction.rb:249:in `eval_children_and_apply_resource' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/util.rb:417:in `thinmark' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/util.rb:416:in `thinmark' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/transaction.rb:248:in `eval_children_and_apply_resource' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/transaction.rb:205:in `eval_resource' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/transaction.rb:294:in `evaluate' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/util.rb:417:in `thinmark' /usr/lib/ruby/1.8/benchmark.rb:308:in `realtime' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/util.rb:416:in `thinmark' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/transaction.rb:293:in `evaluate' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/transaction.rb:287:in `collect' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/transaction.rb:287:in `evaluate' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/resource/catalog.rb:142:in `apply' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/application/puppet.rb:128:in `main' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/application.rb:226:in `send' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/application.rb:226:in `run_command' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/application.rb:217:in `run' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/application.rb:306:in `exit_on_fail' /var/lib/gems/1.8/gems/puppet-0.25.1/lib/puppet/application.rb:217:in `run' /var/lib/gems/1.8/gems/puppet-0.25.1/bin/puppet:71 /var/lib/gems/1.8/bin/puppet:19:in `load' /var/lib/gems/1.8/bin/puppet:19 err: /Service[test]: Failed to retrieve current state of resource: Could not find init script for 'test' debug: Finishing transaction 69902193689720 with 3 changes </pre> If it is run again, it works: <pre> $ /var/lib/gems/1.8/bin/puppet --trace --verbose --debug test.pp debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not exist debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not exist debug: Puppet::Type::Service::ProviderRedhat: file /sbin/chkconfig does not exist debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svstat does not exist debug: Creating default schedules debug: Finishing transaction 69849004852820 with 0 changes debug: //Service[test]/require: requires File[/tmp/init.d/test] debug: Failed to load library 'shadow' for feature 'libshadow' debug: Failed to load library 'ldap' for feature 'ldap' debug: //File[/tmp/init.d/test]: Autorequiring File[/tmp/init.d] info: Applying configuration version '1259890784' debug: Service[test](provider=init): Executing '/tmp/init.d/test status' debug: //Service[test]: Changing ensure debug: //Service[test]: 1 change(s) debug: Service[test](provider=init): Executing '/tmp/init.d/test start' notice: //Service[test]/ensure: ensure changed 'stopped' to 'running' debug: Finishing transaction 69849004850100 with 1 changes </pre> The Exec[test] works as expected, running after the file is created. I cannot see anything wrong with my manifest, so I think this may be a bug. Thank you for any help you can provide! -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://reductivelabs.com/redmine/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" 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-bugs?hl=en.
