1

So, struggling with a fairly major problem, i've tried multiple different workarounds to try and get this working but there is something happening between puppet and the actual server that is just boggling my mind.

Basically, I have an init.d script /etc/init.d/rserve which is copied over correctly and when used from the command-line on the server works perfectly (i.e. sudo service rserve start|stop|status), the service returns correct error codes based on testing using echo $? on the different commands.

The puppet service statement is as follows:

service { 'rserve': 
   ensure => running, 
   enable => true, 
   require => [File["/etc/init.d/rserve"], Package['r-base'], Exec['install-r-packages']] 
}

When puppet hits this service, it runs it's status method, sees that it isn't running and sets it to running and presumably starts the service, the output from puppet is below:

==> twine: debug: /Schedule[weekly]: Skipping device resources because running on a host 
==> twine: debug: /Schedule[puppet]: Skipping device resources because running on a host 
==> twine: debug: Service[rserve](provider=upstart): Could not find rserve.conf in /etc/init 
==> twine: debug: Service[rserve](provider=upstart): Could not find rserve.conf in /etc/init.d 
==> twine: debug: Service[rserve](provider=upstart): Could not find rserve in /etc/init 
==> twine: debug: Service[rserve](provider=upstart): Executing '/etc/init.d/rserve status' 
==> twine: debug: Service[rserve](provider=upstart): Executing '/etc/init.d/rserve start' 
==> twine: notice: /Stage[main]/Etl/Service[rserve]/ensure: ensure changed 'stopped' to 'running'

Now when I actually check for the service using sudo service rserve status or ps aux | grep Rserve the service is in fact NOT running and a quick sudo service rserve start shows the init.d script is working fine and starting rserve as the service starts and is visible with ps aux.

Is there something I'm missing here? I've even tried starting the service by creating a puppet Exec { "sudo service rserve start"} which still reports that it executed successfully but the service is still not running on the server.

tl;dr puppet says a service started when it hasn't and there's seemingly nothing wrong with the init.d script, its exit codes or otherwise.

Update 1 In the comments below you can see I tried isolating the service in it's own test.pp file and running it using puppet apply on the server with the same result.

Update 2 I've now tried creating an .sh file with the command to start Rserve using a separate vagrant provision and can finally see an error. However, the error is confusing as the error does not occur when simply running sudo service rserve start, something in the way that vagrant executes .sh commands, or the user it executes them under is causing an option to be removed from the command inside the init.d script when it's executed.

This error is R and Rserve specific but it is complaining about a missing flag --no-save needing to be passed to R when it is in fact present in the init.d script and being correctly passed when ssh'd into the vagrant box and using the init.d commands.

Update 3 I've managed to get the whole process working at this point, however, it's one of those situations where the steps to get it to work didn't really readily reveal any understanding of why the original problem existed. I'm going to replicate the broken version and see if I can figure out what exactly was going on using one of the methods mentioned in the comments so that I can potentially post an answer up that will help someone out later on. If anyone has insight into why this might have been happening feel free to answer in the meantime however. To clarify the situation a bit, here are some details:

  1. The service's dependencies were installed correctly using puppet
  2. The service used a script in /etc/init.d on ubuntu to start|stop the Rserve service
  3. The software in question is R (r-base) and Rserve (a communication layer between other langs and R)
  4. Running the command sudo service rserve start from the command-line worked as expected
  5. The init.d script returned correct error codes
  6. A service {} block was being used to start the service from puppet
  7. Puppet reported starting the service when the service wasn't started
  8. Adding a provision option to the Vagrantfile for an .sh file containing sudo service rserve start revealed that some arguments in the init.d were being ignored when run by vagrants provisioning but not by a user active on the shell.
Jeff U.
  • 616
  • 1
  • 6
  • 12
  • There must be something that happens "later" in the puppet manifest (or later in time, not in the puppet manifest) that alters the state of the vagrant host – Vorsprung Nov 19 '14 at 16:21
  • I've already tried installing the dependencies for this specific service manually then completely isolating this service entry (removing the require property) and ran the isolated service in a test.pp file using puppet apply with no change in outcome and the exact same puppet output as above. So there's nothing else in the puppet chain (by me) that could be impacting it. – Jeff U. Nov 19 '14 at 20:29
  • Can you add debug output in the form of `logger -t rserve-init "now doing X with variable $Y"` to the initscript? This will help you determine the differences of running through puppet vs. directly via sudo. - Also note that Puppet is using the `upstart` provider, which strikes me as not necessarily appropriate, seeing as you just want need Puppet to invoke the init script. You might want to try `provider => 'init'` or `provider => 'service'`. – Felix Frank Nov 20 '14 at 09:38

0 Answers0