jhoblitt / puppet-selenium

Manages Selenium Server 2 - Standalone and Grid
Other
20 stars 49 forks source link

puppet-selenium didn't ensure service is running #59

Closed marcgascon closed 8 years ago

marcgascon commented 8 years ago

The module ensures that if the initscript is not created or have changes, it will trigger to refresh service[node,hub,server].

But the problem comes when the initscript files are already created and don't have any variation, if the service node,hub or server is down it won't be started again by this module.

So I'm going to do a PR to try to solve this.

marcgascon commented 8 years ago

@jhoblitt could you check it please? I was testing a little bit and I try something like that:

First of alI I apply puppet and the server part turns up and running. I stopped it manually, then retried to run puppet and it doesn't ensure the process is running. Finally to discard human errors while coding in puppet I ran this ():

$ puppet apply -e "service{'seleniumserver': ensure => 'running', hasstatus => true, hasrestart => true}"

And the output was:

Notice: Compiled catalog for "servername" in environment production in 0.09 seconds
Notice: Finished catalog run in 0.22 seconds

(Note that servername was my public domain name that I don't want to publish) So it continues stopped. Then I try:

$ ps -lef | grep selen
0 S root     16990 16566  0  80   0 -  1958 -      10:51 pts/1    00:00:00 grep selen
$ puppet apply -e "service{'seleniumserver': ensure => 'stopped', hasstatus => true, hasrestart => true}"
Notice: Compiled catalog for servername in environment production in 0.08 seconds
Notice: /Stage[main]/Main/Service[seleniumserver]/ensure: ensure changed 'running' to 'stopped'
Notice: Finished catalog run in 0.26 seconds
$ ps -lef | grep selen
0 S root     16990 16566  0  80   0 -  1958 -      10:51 pts/1    00:00:00 grep selen
$

And here comes MY SURPRISE: "Process is not running and puppet tries to stop it!!!"

I don't know if is the initscript, the puppet service resource or what...

If you can take a look at this and give me your feedback I would be very pleased @jhoblitt, so thanks in advance.

marcgascon commented 8 years ago

Hello,

You must use the function status_of_proc, to be able to work with the service resource type. So I'm going to do a PR that solves that.

jhoblitt commented 8 years ago

resolved by #60