Skip to content

Commit f1ca0c1

Browse files
committed
Set non-zero exit status if reload is given args
1 parent 51caeb7 commit f1ca0c1

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
error condition occurs. Previous versions did not set the exit status so
2929
it was always zero. Patch by Luke Weber.
3030

31+
- ``supervisorctl reload`` now gives an error message if an argument is
32+
given. Patch by Joel Krauska.
33+
3134
3.3.1 (2016-08-02)
3235
------------------
3336

supervisor/supervisorctl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -984,10 +984,10 @@ def help_shutdown(self):
984984

985985
def do_reload(self, arg):
986986
if arg:
987-
self.ctl.output('Error: reload given with a process name. Maybe you meant restart?')
987+
self.handle_error('Error: reload accepts no arguments')
988988
self.help_reload()
989989
return
990-
990+
991991
if self.ctl.options.interactive:
992992
yesno = raw_input('Really restart the remote supervisord process '
993993
'y/N? ')

supervisor/tests/test_supervisorctl.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,14 @@ def test_reload(self):
12871287
self.assertEqual(result, None)
12881288
self.assertEqual(options._server.supervisor._restarted, True)
12891289

1290+
def test_reload_arg(self):
1291+
plugin = self._makeOne()
1292+
result = plugin.do_reload('bad')
1293+
self.assertEqual(result, None)
1294+
val = plugin.ctl.stdout.getvalue()
1295+
self.assertTrue(val.startswith('Error: reload accepts no arguments'), val)
1296+
self.assertEqual(plugin.ctl.exit_status, LSBInitErrorCode.GENERIC)
1297+
12901298
def test_shutdown_help(self):
12911299
plugin = self._makeOne()
12921300
plugin.help_shutdown()

0 commit comments

Comments
 (0)