Skip to content

Commit

Permalink
A stop action on an already stopped master/slave should return 0
Browse files Browse the repository at this point in the history
Returning a non-zero exit status when attempting to stop an already
stopped service goes against the LSB init script specifications [1].
Although, the runner scripts are not init scripts (duh) this behaviour
does seem to make more sense (sense is subjective, of course)

[1] http://refspecs.freestandards.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
  • Loading branch information
gvalkov committed Oct 24, 2010
1 parent 4786ecc commit 76d27c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion master/buildbot/scripts/runner.py
Expand Up @@ -1131,7 +1131,13 @@ def run():

start(so)
elif command == "stop":
stop(so, wait=True)
try:
stop(so, wait=True)
except BuildbotNotRunningError:
if not so['quiet']:
print "buildmaster not running"
sys.exit(0)

elif command == "restart":
restart(so)
elif command == "reconfig" or command == "sighup":
Expand Down
4 changes: 2 additions & 2 deletions slave/buildslave/scripts/runner.py
Expand Up @@ -182,8 +182,8 @@ def stop(config, signame="TERM", wait=False, returnFalseOnNotRunning=False):
except:
if returnFalseOnNotRunning:
return False
print "buildslave not running."
sys.exit(1)
if not quiet: print "buildslave not running."
sys.exit(0)
pid = int(f.read().strip())
signum = getattr(signal, "SIG"+signame)
timer = 0
Expand Down

0 comments on commit 76d27c8

Please sign in to comment.