uncloud/scripts/ucloud
2019-12-07 14:25:21 +01:00

50 lines
1.5 KiB
Python
Executable file

#!/usr/bin/env python3
import argparse
import multiprocessing as mp
import logging
from os.path import join as join_path
from ucloud.sanity_checks import check
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser(prog='ucloud',
description='Open Source Cloud Management Software')
arg_parser.add_argument('component',
choices=['api', 'scheduler', 'host',
'filescanner', 'imagescanner',
'metadata'])
arg_parser.add_argument('component_args', nargs='*')
args = arg_parser.parse_args()
try:
if args.component == 'api':
from ucloud.api.main import main
main()
elif args.component == 'host':
from ucloud.host.main import main
hostname = args.component_args
mp.set_start_method('spawn')
main(*hostname)
elif args.component == 'scheduler':
from ucloud.scheduler.main import main
main()
elif args.component == 'filescanner':
from ucloud.filescanner.main import main
main()
elif args.component == 'imagescanner':
from ucloud.imagescanner.main import main
main()
elif args.component == 'metadata':
from ucloud.metadata.main import main
main()
except Exception as e:
logging.exception(e)
print(e)