Ask Your Question
0

Starting service fails

asked 2013-10-01 11:00:42 -0500

spuder gravatar image

updated 2013-10-14 00:56:12 -0500

I'm having a hard time troubleshooting why a service fails to start through puppet. At the end of the puppet run, puppet sets the content of the init script, then ensures that it is running.

class gitlab::service inherits gitlab {
  file { '/etc/init.d/gitlab':
    ensure    => file,
    content   => template('gitlab/gitlab.init.6-1.erb'),
    owner     => root,
    group     => root,
    mode      => '0755',
    before    => Service['gitlab'], 
  }

  #gitlab service
    service { 'gitlab' :
      ensure    => running,
      enable    => true,
      hasrestart  => true,
      hasstatus   => true,  
    }
}

I call the puppet script with debug, and this is the output given

puppet apply /vagrant/gitlab/tests/init.pp --debug
...
#   Notice: /Stage[main ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-10-01 12:55:42 -0500

Stefan gravatar image

updated 2013-10-02 14:11:13 -0500

You tell puppet that the service should run and you are also specifying that your initscript has a status command. Puppet will not try to start the service if the service is already running and puppet will verify that by running /etc/init.d/gitlab status and checking the returncode.

Puppet will treat a returncode of zero as "running" and everything else as "stopped". So I suppose the status command always returns with a zero exitcode and does not comply with the Linux Standard Base Specification

Update: If your service has a crappy initscript that does not use correct exitcodes ... (more)

edit flag offensive delete link more

Comments

I have also tried it with out the hasstatus and hasrestart resources with the same behavior. Running /etc/init.d/gitlab status shows that the process is not running, so ...(more)

spuder gravatar imagespuder ( 2013-10-01 20:14:15 -0500 )edit

Please run `/etc/init.d/gitlab status; echo $?` When I look at https://github.com/gitlabhq/gitlabhq/blob/6-1-stable/lib/support/init.d/gitlab which I suppose is the initscript ...(more)

Stefan gravatar imageStefan ( 2013-10-02 14:00:29 -0500 )edit

Thank you, the script does in fact exit with 0 no matter what. I have opened an issue for this https://github.com/gitlabhq/gitlabhq/issues/5258

spuder gravatar imagespuder ( 2013-10-02 16:48:45 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-10-01 11:00:42 -0500

Seen: 2,095 times

Last updated: Oct 14 '13