Skip to content

Commit

Permalink
fix: align output format for aks command invoke
Browse files Browse the repository at this point in the history
  • Loading branch information
CustardTart32 committed Nov 7, 2024
1 parent fd252bc commit 67b9c42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/azure-cli-core/azure/cli/core/commands/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def update_progress(self):
def end(self):
self.hook.end()


class PollerProgressBar(IndeterminateProgressBar):
def __init__(self, cli_ctx, poller, message="Running"):
super().__init__(cli_ctx, message)
Expand Down
14 changes: 13 additions & 1 deletion src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2103,7 +2103,19 @@ def aks_runcommand(cmd, client, resource_group_name, name, command_string="", co
_aks_command_result_in_progess_helper(client, resource_group_name, name, command_id)
return

return LongRunningOperation(cmd.cli_ctx, progress_bar=PollerProgressBar(cmd.cli_ctx, command_result_poller))(command_result_poller)
progress_bar = PollerProgressBar(cmd.cli_ctx, command_result_poller)
progress_bar.begin()

now = datetime.datetime.now()
while not command_result_poller.done():
if datetime.datetime.now() - now >= datetime.timedelta(seconds=300):
break

progress_bar.update_progress()
time.sleep(0.5)

progress_bar.end()
return _print_command_result(cmd.cli_ctx, command_result_poller.result())


def aks_command_result(cmd, client, resource_group_name, name, command_id=""):
Expand Down

0 comments on commit 67b9c42

Please sign in to comment.