Issue #18266 has been reported by Peter Meier.
----------------------------------------
Bug #18266: init provider fails to manage (ensure => stopped) a service which
init script does not exist anymore
https://projects.puppetlabs.com/issues/18266
Author: Peter Meier
Status: Unreviewed
Priority: Normal
Assignee:
Category: service
Target version:
Affected Puppet version: 3.0.1
Keywords: debian, service, init, provider
Branch:
On a debian stable system:
<pre>
# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 6.0.6 (squeeze)
Release: 6.0.6
Codename: squeeze
</pre>
Trying to ensure that a service is stopped (and later package to be removed)
fails on subsequent runs, when the service is already stopped and gone. The
problem is that the init provider tries to find an init-script which isn't
there anymore => fails to determine status.
<pre>
# cat test.pp
service{'sendmail':
ensure => stopped,
enable => false,
hasstatus => true,
}
# puppet apply --debug test.pp
debug: Puppet::Type::Service::ProviderRedhat: file /sbin/service does not exist
debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl does not
exist
debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not exist
debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update does not
exist
debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svstat does
not exist
debug: Creating default schedules
debug: Failed to load library 'selinux' for feature 'selinux'
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Puppet::Type::User::ProviderLdap: true value when expecting false
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does
not exist
debug: Puppet::Type::User::ProviderUser_role_add: file rolemod does not exist
debug: Puppet::Type::File::ProviderMicrosoft_windows: feature microsoft_windows
is missing
debug: Failed to load library 'ldap' for feature 'ldap'
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/public_keys/tramp.glei.ch.pem]: Autorequiring
File[/var/lib/puppet/ssl/public_keys]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/crl.pem]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl/private_keys/tramp.glei.ch.pem]: Autorequiring
File[/var/lib/puppet/ssl/private_keys]
debug: /File[/var/lib/puppet/state/last_run_summary.yaml]: Autorequiring
File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring
File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring
File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/classes.txt]: Autorequiring
File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring
File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/certs/tramp.glei.ch.pem]: Autorequiring
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/state/last_run_report.yaml]: Autorequiring
File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/certs/ca.pem]: Autorequiring
File[/var/lib/puppet/ssl/certs]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet]
debug: Finishing transaction -614010188
debug: Loaded state in 0.77 seconds
debug: Loaded state in 0.77 seconds
info: Applying configuration version '1356345789'
debug: Service[sendmail](provider=debian): Could not find sendmail in
/etc/init.d
debug: Service[sendmail](provider=debian): Could not find sendmail.sh in
/etc/init.d
/usr/lib/ruby/1.8/puppet/provider/service/init.rb:116:in `search'
/usr/lib/ruby/1.8/puppet/provider/service/init.rb:70:in `initscript'
/usr/lib/ruby/1.8/puppet/provider/service/init.rb:137:in `statuscmd'
/usr/lib/ruby/1.8/puppet/provider/service/base.rb:58:in `status'
/usr/lib/ruby/1.8/puppet/type/service.rb:73:in `retrieve'
/usr/lib/ruby/1.8/puppet/type.rb:685:in `retrieve'
/usr/lib/ruby/1.8/puppet/type.rb:703:in `retrieve_resource'
/usr/lib/ruby/1.8/puppet/transaction/resource_harness.rb:32:in `perform_changes'
/usr/lib/ruby/1.8/puppet/transaction/resource_harness.rb:133:in `evaluate'
/usr/lib/ruby/1.8/puppet/transaction.rb:48:in `apply'
/usr/lib/ruby/1.8/puppet/transaction.rb:113:in
`eval_children_and_apply_resource'
/usr/lib/ruby/1.8/puppet/transaction.rb:91:in `eval_resource'
/usr/lib/ruby/1.8/puppet/transaction.rb:138:in `evaluate'
/usr/lib/ruby/1.8/puppet/util.rb:403:in `thinmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/1.8/puppet/util.rb:402:in `thinmark'
/usr/lib/ruby/1.8/puppet/transaction.rb:137:in `evaluate'
/usr/lib/ruby/1.8/puppet/transaction.rb:130:in `each'
/usr/lib/ruby/1.8/puppet/transaction.rb:130:in `evaluate'
/usr/lib/ruby/1.8/puppet/resource/catalog.rb:150:in `apply'
/usr/lib/ruby/1.8/puppet/configurer.rb:120:in `retrieve_and_apply_catalog'
/usr/lib/ruby/1.8/puppet/util.rb:178:in `benchmark'
/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/usr/lib/ruby/1.8/puppet/util.rb:177:in `benchmark'
/usr/lib/ruby/1.8/puppet/configurer.rb:119:in `retrieve_and_apply_catalog'
/usr/lib/ruby/1.8/puppet/configurer.rb:150:in `run'
/usr/lib/ruby/1.8/puppet/application/apply.rb:131:in `main'
/usr/lib/ruby/1.8/puppet/application/apply.rb:35:in `run_command'
/usr/lib/ruby/1.8/puppet/application.rb:305:in `run'
/usr/lib/ruby/1.8/puppet/application.rb:420:in `hook'
/usr/lib/ruby/1.8/puppet/application.rb:305:in `run'
/usr/lib/ruby/1.8/puppet/application.rb:411:in `exit_on_fail'
/usr/lib/ruby/1.8/puppet/application.rb:305:in `run'
/usr/lib/ruby/1.8/puppet/util/command_line.rb:62:in `execute'
/usr/bin/puppet:4
err: /Stage[main]//Service[sendmail]: Could not evaluate: Could not find init
script for 'sendmail'
debug: Finishing transaction -614580918
debug: Storing state
debug: Stored state in 3.25 seconds
notice: Finished catalog run in 4.10 seconds
</pre>
While I see the general problem, that if hasstatus is set to true and the
init-script is missing we can't determine the current status, it still requires
to handle disabling a service different, as I need to set (hasstatus => false)
for service that should be removed.
Afaik the redhat provider doesn't call the init script directly, it rathers
calls `service sendmail stop` which fails if the service is not anymore
present, so we "safely" assume that the service isn't running anymore. -> No
error is raised.
The behavior I would like to see is, that if I want to stop a service with the
init provider and hasstatus is set to ture and there is no init.d script for
it, it should be assumed to be stopped.
While in general the init provider still assumes, that there is not status
command on init scripts, things have changed in the past few years and many got
one. However, the init provider is still default on debian and hence it can
become tricky to deal with legacy issues of the init provider.
--
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://projects.puppetlabs.com/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.