Gracefully terminate server when SIGINT is caught

Change-Id: I54d69de70f6f200faca1e48d7e040747907327b0
This commit is contained in:
Ilya Shakhat
2015-03-27 13:52:27 +03:00
parent affe2202b3
commit 75c770877f

View File

@@ -209,8 +209,11 @@ def main():
result = execute(quorum, scenario['execution'], agents)
LOG.debug('Result: %s', result)
except Exception as e:
LOG.error('Error while executing scenario: %s', e)
except BaseException as e:
if isinstance(e, KeyboardInterrupt):
LOG.info('Caught SIGINT. Terminating')
else:
LOG.error('Error while executing scenario: %s', e)
finally:
if deployment:
deployment.cleanup()