Modify deploy/client.py 39/36239/3
authorhuangxiangyu <huangxiangyu5@huawei.com>
Tue, 20 Jun 2017 12:42:07 +0000 (20:42 +0800)
committerHarry Huang <huangxiangyu5@huawei.com>
Thu, 13 Jul 2017 02:25:12 +0000 (02:25 +0000)
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 <huangxiangyu5@huawei.com>
deploy/client.py

index 6d5daa3..366ae41 100644 (file)
@@ -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: