Quickly fix 'slapos node' supervisor commands

parent 3748a55b
...@@ -124,8 +124,9 @@ def dispatch(command, is_node_command): ...@@ -124,8 +124,9 @@ def dispatch(command, is_node_command):
elif command == 'format': elif command == 'format':
call(format, config=GLOBAL_SLAPOS_CONFIGURATION, option=['-c']) call(format, config=GLOBAL_SLAPOS_CONFIGURATION, option=['-c'])
elif command in ['start', 'stop', 'status', 'tail']: elif command in ['start', 'stop', 'status', 'tail']:
supervisord() # Again, too hackish
supervisorctl() sys.argv[-2:-2] = [command]
call(supervisorctl, config=GLOBAL_SLAPOS_CONFIGURATION)
else: else:
return False return False
elif command == 'request': elif command == 'request':
...@@ -146,21 +147,22 @@ def main(): ...@@ -146,21 +147,22 @@ def main():
Main entry point of SlapOS Node. Used to dispatch commands to python Main entry point of SlapOS Node. Used to dispatch commands to python
module responsible of the operation. 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 "node" arg is the first: we strip it and set a switch
if len(sys.argv) > 1 and sys.argv[1] == "node": if len(sys.argv) > 1 and sys.argv[1] == "node":
sys.argv.pop(1) 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 is_node = True
else: else:
is_node = False 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() namespace = parser.parse_args()
# Set sys.argv for the sub-entry point that we will call # Set sys.argv for the sub-entry point that we will call
command_line = [namespace.command] command_line = [namespace.command]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment