aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-04-03 22:51:33 +0000
committerGerrit Code Review <review@openstack.org>2017-04-03 22:51:33 +0000
commit070a12444f4ec5dca33f4a6e6a303f9bc8da5197 (patch)
tree3aa83c82d7805adcaa70455e2b934f5d0431dc34 /docker
parent2d278ea347feb254232295b69a90955b588698c3 (diff)
parent730cd93771e4d1fcf41351e80f8cc8540c563bc7 (diff)
downloadkolla-070a12444f4ec5dca33f4a6e6a303f9bc8da5197.tar.gz
kolla-070a12444f4ec5dca33f4a6e6a303f9bc8da5197.zip
Merge "Optimize the code"
Diffstat (limited to 'docker')
-rw-r--r--docker/base/set_configs.py39
1 files changed, 19 insertions, 20 deletions
diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py
index a2d875a47..9c3d1f1e4 100644
--- a/docker/base/set_configs.py
+++ b/docker/base/set_configs.py
@@ -392,28 +392,27 @@ def execute_config_check(config):
def main():
- parser = argparse.ArgumentParser()
- parser.add_argument('--check',
- action='store_true',
- required=False,
- help='Check whether the configs changed')
- args = parser.parse_args()
- config = load_config()
-
- if args.check:
- execute_config_check(config)
- else:
- execute_config_strategy(config)
-
-
-if __name__ == "__main__":
- _exit_code = 0
try:
- main()
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--check',
+ action='store_true',
+ required=False,
+ help='Check whether the configs changed')
+ args = parser.parse_args()
+ config = load_config()
+
+ if args.check:
+ execute_config_check(config)
+ else:
+ execute_config_strategy(config)
except ExitingException as e:
LOG.error("%s: %s", e.__class__.__name__, e)
- _exit_code = e.exit_code
+ return e.exit_code
except Exception:
LOG.exception('Unexpected error:')
- _exit_code = 2
- sys.exit(_exit_code)
+ return 2
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())