diff --git a/libs/platforms/rosa/terraform/terraform.py b/libs/platforms/rosa/terraform/terraform.py index fa404de..1f2d2ab 100644 --- a/libs/platforms/rosa/terraform/terraform.py +++ b/libs/platforms/rosa/terraform/terraform.py @@ -235,15 +235,15 @@ def delete_cluster(self, platform, cluster_name): cluster_info["total_count"] = platform.environment['cluster_count'] self.logging.info(f"Checking uninstall log for cluster {cluster_name}") - while retry_loop <= 3600: # 2hr timeout + while retry_loop <= 600: # 1hr timeout retry_loop += 1 cluster_delete_start_time = int(datetime.datetime.utcnow().timestamp()) watch_code, watch_out, watch_err = self.utils.subprocess_exec("rosa logs uninstall -c " + cluster_name + " --watch", cluster_info["path"] + "/cleanup.log", {'preexec_fn': self.utils.disable_signals}) if watch_code != 0: - if retry_loop <= 3600: - self.logging.debug(f"ROSA cluster {cluster_name} is not available yet, retrying..") + if retry_loop <= 600: + self.logging.debug(f"ROSA cluster uninstall log for {cluster_name} is not available yet, retrying..") self.logging.debug(watch_out) - time.sleep(5) + time.sleep(6) else: cluster_info['status'] = "not deleted" self.logging.debug(watch_out) @@ -319,22 +319,26 @@ def create_cluster(self, platform, cluster_name): os.mkdir(cluster_info["path"]) self.logging.debug("Output directory set to %s" % cluster_info["path"]) - while retry_loop <= 7200: # 2hr timeout + while retry_loop <= 1800: # 1hr timeout retry_loop += 1 cluster_start_time = int(datetime.datetime.utcnow().timestamp()) - watch_code, watch_out, watch_err = self.utils.subprocess_exec("rosa logs install -c " + cluster_name + " --watch", cluster_info["path"] + "/installation.log", {'preexec_fn': self.utils.disable_signals}) - if watch_code != 0: - if retry_loop <= 7200: + status_code, status_out, status_err = self.utils.subprocess_exec("rosa describe cluster -c " + cluster_name + " -o json", extra_params={"universal_newlines": True}) + if status_code != 0: + if retry_loop <= 1800: self.logging.debug(f"ROSA cluster {cluster_name} is not available yet, retrying..") - self.logging.debug(watch_out) - time.sleep(5) + self.logging.debug(status_out) + time.sleep(2) else: cluster_info['status'] = "not ready" self.logging.debug(watch_out) self.logging.error(watch_err) return 1 else: + preflight_ch = self._preflight_wait(cluster_name, cluster_name) + cluster_info["preflight_checks"] = preflight_ch.result() break + + watch_code, watch_out, watch_err = self.utils.subprocess_exec("rosa logs install -c " + cluster_name + " --watch", cluster_info["path"] + "/installation.log", {'preexec_fn': self.utils.disable_signals}) cluster_info['status'] = "installed" cluster_end_time = int(datetime.datetime.utcnow().timestamp()) # Getting againg metadata to update the cluster status