Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/badfish/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,9 +867,10 @@ async def check_schedule_job_status(self, job_id):
return False

async def check_job_status(self, job_id):
with polling_progress(
self.console, self.retries, "Status", disable=self._progress_disabled
) as (progress, task_id):
with polling_progress(self.console, self.retries, "Status", disable=self._progress_disabled) as (
progress,
task_id,
):
for count in range(self.retries):
_url = f"{self.host_uri}{self.manager_resource}/Jobs/{job_id}"
self.http_client.get_request.cache_clear()
Expand Down Expand Up @@ -1319,9 +1320,10 @@ async def polling_host_state(self, state, equals=True):
state_str = "Not %s" % state if not equals else state
self.logger.info("Polling for host state: %s" % state_str)
desired_state = False
with polling_progress(
self.console, self.retries, "Host state", disable=self._progress_disabled
) as (progress, task_id):
with polling_progress(self.console, self.retries, "Host state", disable=self._progress_disabled) as (
progress,
task_id,
):
for count in range(self.retries):
current_state = await self.get_power_state()
if equals:
Expand All @@ -1338,9 +1340,10 @@ async def polling_host_state(self, state, equals=True):

async def poll_until_ready(self, check_func, description, sleep_interval=5, clear_cache=False):
self.logger.info("Polling for %s" % description)
with polling_progress(
self.console, self.retries, "Host state", disable=self._progress_disabled
) as (progress, task_id):
with polling_progress(self.console, self.retries, "Host state", disable=self._progress_disabled) as (
progress,
task_id,
):
for count in range(self.retries):
if clear_cache:
self.http_client.get_request.cache_clear()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_pass(self, mock_get, mock_post, mock_delete):
self.set_mock_response(mock_delete, 200, "OK")
self.args = [self.option_arg, "./exports/"]
_, err = self.badfish_call()
assert err == RESPONSE_EXPORT_SCP_PASS % (datetime.now().strftime("%Y-%m-%d_%H%M%S"))
assert err == RESPONSE_EXPORT_SCP_PASS % (fixed_datetime().strftime("%Y-%m-%d_%H%M%S"))

@patch("aiohttp.ClientSession.delete")
@patch("aiohttp.ClientSession.post")
Expand Down
Loading