From 9d91215c859c5ebad4ba94e9c321f28ddb7b0316 Mon Sep 17 00:00:00 2001 From: huangxiangyu Date: Tue, 20 Jun 2017 20:42:07 +0800 Subject: Modify deploy/client.py Bug: 1. when ansible_print process encounter runtime error e.g. ansible.log doesn't exist, whole client.py process stucks. 2. cobbler status encounters error when deploy timeout happens. Solution: 1. add ansible_print process alive check in function get_installing_progress to exit parent process when child process encounter runtime error. 2. remove unnecessary code in calling cobbler status which cause error. Change-Id: Ie04d45fd612e7273a6d584e3efb69e1506cdd0f9 Signed-off-by: huangxiangyu --- deploy/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deploy/client.py b/deploy/client.py index 6d5daa38..366ae418 100644 --- a/deploy/client.py +++ b/deploy/client.py @@ -952,6 +952,9 @@ class CompassClient(object): deployment_timeout = time.time() + 60 * float(CONF.deployment_timeout) # noqa current_time = time.time while current_time() < deployment_timeout: + if not ansible_print.is_alive(): + raise RuntimeError("can not get ansible log") + status, cluster_state = self.get_cluster_state(cluster_id) if not self.is_ok(status): raise RuntimeError("can not get cluster state") @@ -975,7 +978,7 @@ class CompassClient(object): % (current_time(), deployment_timeout)) LOG.info("cobbler status:") os.system("sudo docker exec compass-cobbler bash -c \ - 'cobbler status'" % (CONF.rsa_file)) + 'cobbler status'") raise RuntimeError("installation timeout") try: -- cgit 1.2.3-korg