From 1fba79ca319b4ee51650fc6176b8b3264cb3f43d Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 31 Dec 2019 11:56:28 +0100 Subject: [PATCH] remove syslog handler (cruft), add debug flag --- scripts/uncloud | 18 ++++++------------ uncloud/api/main.py | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/scripts/uncloud b/scripts/uncloud index e5c4081..d22c6d0 100755 --- a/scripts/uncloud +++ b/scripts/uncloud @@ -22,32 +22,26 @@ sys.excepthook = exception_hook if __name__ == '__main__': # Setting up root logger logger = logging.getLogger() + logger.setLevel(logging.DEBUG) - syslog_handler = SysLogHandler(address='/dev/log') - syslog_handler.setLevel(logging.DEBUG) - syslog_formatter = logging.Formatter('%(pathname)s:%(lineno)d -- %(levelname)-8s %(message)s') - syslog_handler.setFormatter(syslog_formatter) - - logger.addHandler(syslog_handler) + parent_parser = argparse.ArgumentParser(add_help=False) + parent_parser.add_argument("--debug", "-d", action='store_true') arg_parser = argparse.ArgumentParser() + subparsers = arg_parser.add_subparsers(dest="command") - api_parser = subparsers.add_parser("api") - + api_parser = subparsers.add_parser("api", parents=[parent_parser]) host_parser = subparsers.add_parser("host") host_parser.add_argument("--hostname", required=True) scheduler_parser = subparsers.add_parser("scheduler") - filescanner_parser = subparsers.add_parser("filescanner") - imagescanner_parser = subparsers.add_parser("imagescanner") - metadata_parser = subparsers.add_parser("metadata") - config_parser = subparsers.add_parser("configure") + configure_parser(config_parser) args = arg_parser.parse_args() diff --git a/uncloud/api/main.py b/uncloud/api/main.py index 6ac5d44..37c6c5b 100644 --- a/uncloud/api/main.py +++ b/uncloud/api/main.py @@ -561,7 +561,7 @@ api.add_resource(ListHost, "/host/list") api.add_resource(CreateNetwork, "/network/create") -def main(): +def main(debug=False): image_stores = list( shared.etcd_client.get_prefix( settings["etcd"]["image_store_prefix"], value_in_json=True