Search code examples
ubuntudropboxpuppet

Why can't puppet start the dropbox daemon?


I'm using the Dropbox command-line utility/daemon on Ubuntu 11.10 but it's not working with Puppet.

I can successfully control dropbox manually:

$ sudo /etc/init.d/dropbox [status/start/stop/status]

However when I configure Puppet to ensure that dropbox is always running, it fails with this log message:

(/Stage[main]/Dropbox::Service/Service[dropbox]/ensure) change from stopped to running failed: Could not start Service[dropbox]: Execution of '/etc/init.d/dropbox start' returned 1:  at /etc/puppet/modules/dropbox/manifests/init.pp:8

Here is my puppet manifest file:

class dropbox {
  include dropbox::service
}

class dropbox::service {
  service { "dropbox":
    ensure => running,
  }
}

The above error message also seems to imply that the dropbox "status" command isn't working for Puppet because I get the same error message ("Could not start") even when Dropbox is already running.

Any thoughts?


Solution

  • Puppet versions before 2.7 by default don't use /etc/init.d/service status command. They look for process name in process table, so if the daemon process name is different from service name those behaviour will give you errors like:

     ...Service[dropbox]/ensure) change from stopped to running failed...
    

    on every execution of puppet agent. You should check if that service has working status command:

     sudo /etc/init.d/dropbox status; echo $?
     # That command should return output with "running" text and return code 0 like:
     dropboxd for USER dropbox: running (pid 9823)
     0
    

    Then tell the puppet to use it instead of it's own (<2.7) mechanisms - put "hasstatus => true," in service definition.