Skip to content

Commit

Permalink
Try sampler
Browse files Browse the repository at this point in the history
  • Loading branch information
oharan2 committed May 31, 2023
1 parent 726faf3 commit 0582191
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion ocm_python_wrapper/cluster.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from importlib.util import find_spec

import ipdb
import rosa.cli as rosa_cli
import yaml
from benedict import benedict
Expand Down Expand Up @@ -395,8 +396,13 @@ def install_addon(
params_command = ""
for parameter in parameters:
params_command += f" --{parameter['id']} {parameter['value']}"
res = rosa_cli.execute(
# res = rosa_cli.execute(
# command=f"install addon {self.addon_name} --cluster {self.name} {params_command}"
# )
ipdb.set_trace()
res = wait_for_rosa_installation(
command=f"install addon {self.addon_name} --cluster {self.name} {params_command}"
# f" --billing-model standard"
)
else:
if parameters:
Expand Down Expand Up @@ -571,3 +577,22 @@ def addon_installation_instance_sampler(func, wait_timeout=TIMEOUT_30MIN):
sleep=SLEEP_1SEC,
func=func,
)


def wait_for_rosa_installation(command, wait_timeout=TIMEOUT_30MIN):
ipdb.set_trace()
for rosa_sampler in TimeoutSampler(
wait_timeout=wait_timeout,
sleep=SLEEP_1SEC,
func=lambda: rosa_cli.execute(command=command),
):
ipdb.set_trace()
if rosa_sampler:
return True
ipdb.set_trace()
# except TimeoutExpiredError:
# LOGGER.error(
# f"Timeout waiting for {self.addon_name} state to execute {command}"
# )
# raise
return False

0 comments on commit 0582191

Please sign in to comment.