forked from uncloud/uncloud
remove syslog handler (cruft), add debug flag
This commit is contained in:
parent
4c7678618d
commit
1fba79ca31
2 changed files with 7 additions and 13 deletions
|
@ -22,32 +22,26 @@ sys.excepthook = exception_hook
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Setting up root logger
|
# Setting up root logger
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
syslog_handler = SysLogHandler(address='/dev/log')
|
parent_parser = argparse.ArgumentParser(add_help=False)
|
||||||
syslog_handler.setLevel(logging.DEBUG)
|
parent_parser.add_argument("--debug", "-d", action='store_true')
|
||||||
syslog_formatter = logging.Formatter('%(pathname)s:%(lineno)d -- %(levelname)-8s %(message)s')
|
|
||||||
syslog_handler.setFormatter(syslog_formatter)
|
|
||||||
|
|
||||||
logger.addHandler(syslog_handler)
|
|
||||||
|
|
||||||
arg_parser = argparse.ArgumentParser()
|
arg_parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
subparsers = arg_parser.add_subparsers(dest="command")
|
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 = subparsers.add_parser("host")
|
||||||
host_parser.add_argument("--hostname", required=True)
|
host_parser.add_argument("--hostname", required=True)
|
||||||
|
|
||||||
scheduler_parser = subparsers.add_parser("scheduler")
|
scheduler_parser = subparsers.add_parser("scheduler")
|
||||||
|
|
||||||
filescanner_parser = subparsers.add_parser("filescanner")
|
filescanner_parser = subparsers.add_parser("filescanner")
|
||||||
|
|
||||||
imagescanner_parser = subparsers.add_parser("imagescanner")
|
imagescanner_parser = subparsers.add_parser("imagescanner")
|
||||||
|
|
||||||
metadata_parser = subparsers.add_parser("metadata")
|
metadata_parser = subparsers.add_parser("metadata")
|
||||||
|
|
||||||
config_parser = subparsers.add_parser("configure")
|
config_parser = subparsers.add_parser("configure")
|
||||||
|
|
||||||
configure_parser(config_parser)
|
configure_parser(config_parser)
|
||||||
args = arg_parser.parse_args()
|
args = arg_parser.parse_args()
|
||||||
|
|
||||||
|
|
|
@ -561,7 +561,7 @@ api.add_resource(ListHost, "/host/list")
|
||||||
api.add_resource(CreateNetwork, "/network/create")
|
api.add_resource(CreateNetwork, "/network/create")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(debug=False):
|
||||||
image_stores = list(
|
image_stores = list(
|
||||||
shared.etcd_client.get_prefix(
|
shared.etcd_client.get_prefix(
|
||||||
settings["etcd"]["image_store_prefix"], value_in_json=True
|
settings["etcd"]["image_store_prefix"], value_in_json=True
|
||||||
|
|
Loading…
Reference in a new issue