diff --git a/main.py b/main.py index 12ab0fe..b537b2d 100755 --- a/main.py +++ b/main.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -import functools import os import sys import logging @@ -121,7 +120,7 @@ def main(config, dryrun, level, range): break else: logger.error('couldn\'t find valid adapter for source configuration %s', source) - return 1 + sys.exit(1) for sink in config['sinks']: assert len(sink.keys()) == 1 for aname, a in adapters.ADAPTERS.items(): @@ -130,19 +129,19 @@ def main(config, dryrun, level, range): break else: logger.error('couldn\'t find valid adapter for sink configuration %s', sink) - return 1 + sys.exit(1) if not all([isinstance(x, adapters.Source) for x in sources]): logger.error('one or more source configurations do not implement being a source') - return 1 + sys.exit(1) if not all([isinstance(x, adapters.Sink) for x in sinks]): logger.error('one or more sink configurations do not implement being a sink') - return 1 + sys.exit(1) # log in if not all([x.login() for x in sources | sinks]): logger.error('failed to log into one or more sinks or sources') - return 1 + sys.exit(1) # gather events events = [] @@ -156,7 +155,7 @@ def main(config, dryrun, level, range): source_results += [False] if not any(source_results): logger.error('event get failed for all sources') - return 1 + sys.exit(1) # filter cancelled events logger.info('found %d events', len(events)) logger.info('not syncing cancelled events') @@ -177,10 +176,10 @@ def main(config, dryrun, level, range): sink_results += [False] if not any(sink_results): logger.error('event post failed for all sinks') - return 1 + sys.exit(1) logger.info("done") - return 0 + sys.exit(0) if __name__ == '__main__': main()