From d1676d38e41bd1ec4f6468d47fdd7d1f076b6f43 Mon Sep 17 00:00:00 2001 From: Jeffrey Zhang Date: Fri, 14 Oct 2016 16:44:54 +0800 Subject: [PATCH] move sys.exit out of try finally block in set_config.py file when code exit by using sys.exit in try..catch block, it will skip catch and run the code in finally. Because SystemExit does not inherit from Exception. This patch moves sys.exit out of finally block. Then it won't execute when script exits by sys.exit Change-Id: I6457b1b861d2f9fdadce788ac6b719f46c7f2af3 Partial-Bug: #1631503 --- docker/base/set_configs.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index cd89992e08..01ae8bc1a8 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -305,5 +305,4 @@ if __name__ == "__main__": except Exception: exit_code = 1 LOG.exception('Unexpected error:') - finally: - sys.exit(exit_code) + sys.exit(exit_code)