From aec840142a5cb999246120e6707ef364c3a84c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com> Date: Thu, 18 Oct 2012 16:34:32 +0200 Subject: [PATCH] Quickly fix 'slapos node' supervisor commands --- slapos/entry.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/slapos/entry.py b/slapos/entry.py index c69e519e0..1cebd7c83 100644 --- a/slapos/entry.py +++ b/slapos/entry.py @@ -124,8 +124,9 @@ def dispatch(command, is_node_command): elif command == 'format': call(format, config=GLOBAL_SLAPOS_CONFIGURATION, option=['-c']) elif command in ['start', 'stop', 'status', 'tail']: - supervisord() - supervisorctl() + # Again, too hackish + sys.argv[-2:-2] = [command] + call(supervisorctl, config=GLOBAL_SLAPOS_CONFIGURATION) else: return False elif command == 'request': @@ -146,21 +147,22 @@ def main(): Main entry point of SlapOS Node. Used to dispatch commands to python module responsible of the operation. """ - # XXX-Cedric: add "description" for parser. - # Parse arguments - parser = argparse.ArgumentParser() - parser.add_argument('command') - # XXX-Cedric: "slapos node" should display "supervisorctl status". - # Currently it does nothing - parser.add_argument('argument_list', nargs=argparse.REMAINDER) - # If "node" arg is the first: we strip it and set a switch if len(sys.argv) > 1 and sys.argv[1] == "node": sys.argv.pop(1) + # Hackish way to show status if no argument is specified + if len(sys.argv) is 1: + sys.argv.append('status') is_node = True else: is_node = False + # XXX-Cedric: add "description" for parser. + # Parse arguments + parser = argparse.ArgumentParser() + parser.add_argument('command') + parser.add_argument('argument_list', nargs=argparse.REMAINDER) + namespace = parser.parse_args() # Set sys.argv for the sub-entry point that we will call command_line = [namespace.command] -- 2.30.9