Bug #2887
Service (init) does not seem to work with require properly
| Status: | Closed | Start date: | 12/04/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | - | |||
| Target version: | 0.25.3 | |||
| Affected Puppet version: | 0.25.2 | Branch: | http://github.com/jes5199/puppet/tree/ticket/0.25.x/2887 | |
| Keywords: | ||||
| Votes: | 0 |
Description
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:
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" ];
#}
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:
$ /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
If it is run again, it works:
$ /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
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!
History
Updated by James Turnbull about 2 years ago
- Status changed from Unreviewed to Investigating
- Assignee set to Markus Roberts
Updated by Markus Roberts about 2 years ago
- Assignee changed from Markus Roberts to Jesse Wolfe
- Target version set to 0.25.3
Updated by Jesse Wolfe about 2 years ago
- Status changed from Investigating to Accepted
- Affected Puppet version changed from 0.25.1 to 0.25.2
Confirmed this is a bug in 0.25.2
Updated by Markus Roberts about 2 years ago
- Target version changed from 0.25.3 to 0.25.4
Updated by Jesse Wolfe about 2 years ago
- Status changed from Accepted to In Topic Branch Pending Review
- Target version changed from 0.25.4 to 0.25.3
- Branch set to http://github.com/jes5199/puppet/tree/ticket/0.25.x/2887
Updated by Erik Hetzner about 2 years ago
Thank you!
Updated by James Turnbull about 2 years ago
- Status changed from In Topic Branch Pending Review to Closed
Pushed in commit:0a7e212cb824a3a13bc00abf2e69aa3852c6c4d9 in branch 0.25.x