uncloud/scripts/ucloud
Nico Schottelius 5b44034602 cleanup
2019-12-08 14:15:36 +01:00

33 lines
937 B
Python
Executable file

#!/usr/bin/env python3
import argparse
import logging
import importlib
import sys
import os
COMMANDS = ['api', 'scheduler', 'host', 'filescanner', 'imagescanner', 'metadata']
if __name__ == "__main__":
log = logging.getLogger("ucloud")
arg_parser = argparse.ArgumentParser(prog='ucloud',
description='Open Source Cloud Management Software')
arg_parser.add_argument('-c', '--conf-dir', help="Configuration directory")
arg_parser.add_argument('component', choices=COMMANDS)
arg_parser.add_argument('component_args', nargs='*')
args = arg_parser.parse_args()
if args.conf_dir:
os.environ['UCLOUD_CONF_DIR'] = args.conf_dir
try:
name = args.component
mod = importlib.import_module("ucloud.{}.main".format(name))
main = getattr(mod, "main")
main()
except Exception as e:
logging.exception(e)
print(e)