Skip to content

Commit 334edff

Browse files
committed
return -1 on wait for status failure
1 parent 2f7be92 commit 334edff

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

bin/cli.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,23 @@ def wait_for_status(
480480
:returns True/False if status was found within timeout_secs. May raise APIException.
481481
"""
482482
cluster_status = [K8sClusterStatus[s] for s in status]
483-
get_client().k8s_cluster.wait_for_status(
484-
k8scluster_id=k8scluster_id, status=cluster_status,
485-
)
483+
484+
try:
485+
success = get_client().k8s_cluster.wait_for_status(
486+
k8scluster_id=k8scluster_id,
487+
status=cluster_status,
488+
timeout_secs=timeout_secs,
489+
)
490+
except:
491+
success = False
492+
493+
if not success:
494+
print(
495+
"Failed to reach state(s) {} in {}".format(
496+
str(status), str(timeout_secs),
497+
)
498+
)
499+
sys.exit(1)
486500

487501
def statuses(self,):
488502
"""Return a list of valid statuses"""

0 commit comments

Comments
 (0)