[chef] RE: Not detecting service start failure


Chronological Thread 
  • From: "Fouts, Chris" < >
  • To: Yoshi Spendiff < >, chef < >
  • Subject: [chef] RE: Not detecting service start failure
  • Date: Tue, 12 May 2015 04:12:37 +0000
  • Accept-language: en-US

On top of the script in /etc/init.d that starts the service, try adding the following line

. /etc/init.d/function

Chris

Sent from my iPad using Mail+ for Outlook

From: Yoshi Spendiff
Sent: 5/11/15, 9:57 PM
To: chef
Subject: [chef] Not detecting service start failure

Hi,

I'm having trouble understanding why Chef isn't detecting that a service is failing to start. I'm attempting to get Pound (proxy) to work. The package installs fine and I have a service declaration that says the service is started when it's not. I'm running via chef solo at the moment (it's a vagrant box) and running a chef-solo run with debug logging produces the following:

[2015-05-12T01:45:50+00:00] DEBUG: service[pound] you have specified a status command, running..
pound is stopped
pound              0:off    1:off    2:on    3:on    4:on    5:on    6:off
Starting Pound: starting...
[FAILED]
Starting Pound: starting...
[FAILED]
Starting Pound: starting...
[FAILED]
Starting Pound: starting...
[FAILED]
Starting Pound: starting...
[FAILED]
[2015-05-12T01:45:52+00:00] INFO: service[pound] started
- start service service[pound]


This are my recipe declaration:


# Install pound and deploy configuration file from template
package 'Pound' do
  options '--enablerepo=epel'
end

template '/etc/pound.cfg' do
  source 'pound.cfg.erb'
  mode 0644
end

service 'pound' do
  supports :restart => false, :reload => false, :status => true
  action [:start, :enable]
end

I have tried using the init_command and status_command options, as well as disabling and enabling the supports :status => true option

If I put the above service declaration into a test file and run it with chef-apply then it fails as it should:
[2015-05-12T01:56:28+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: service[pound] ((chef-apply cookbook)::(chef-apply recipe) line 5) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /sbin/service pound start ----
STDOUT: Starting Pound: [FAILED]
STDERR: starting...
---- End output of /sbin/service pound start ----
Ran /sbin/service pound start returned 1


The pound init script is set up to run correctly, a non-zero exit code is returned on unsuccessful start of pound.

There are no processes called pound running on the system and there are no other service declarations called pound in all of my cookbooks.

What am I missing?

Cheers

--
Yoshi Spendiff
Ops Engineer
Indochino
Mobile: +1 778 952 2025



Archive powered by MHonArc 2.6.16.

§