Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore failure of stop command if start succeeds with state=restarted #1096

Merged
merged 1 commit into from
Sep 26, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions library/service
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def main():
# ===========================================
# run change commands if we need to
if changed:

if state in ['started', 'running']:
rc_state, stdout, stderr = _run("%s %s start" % (SERVICE, name))
elif state == 'stopped':
Expand All @@ -234,9 +235,14 @@ def main():
elif state == 'restarted':
rc1, stdout1, stderr1 = _run("%s %s stop" % (SERVICE, name))
rc2, stdout2, stderr2 = _run("%s %s start" % (SERVICE, name))
rc_state = rc + rc1 + rc2
stdout = stdout1 + stdout2
stderr = stderr1 + stderr2
if rc1 != 0 and rc2 == 0:
rc_state = rc + rc2
stdout = stdout2
stderr = stderr2
else:
rc_state = rc + rc1 + rc2
stdout = stdout1 + stdout2
stderr = stderr1 + stderr2

out += stdout
err += stderr
Expand Down