From 18b4c508e03392facaad31a597f2f913182da106 Mon Sep 17 00:00:00 2001 From: Pallab Pain Date: Mon, 19 Aug 2024 16:27:39 +0530 Subject: [PATCH] fix(device): updates client in list device deployments command The rio device deployment command was still using the old client to invoke the list deployments API. This commit updates the command to use the v2 client with the right query parameters. --- riocli/device/deployment.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/riocli/device/deployment.py b/riocli/device/deployment.py index 6f0238a0..1926a229 100644 --- a/riocli/device/deployment.py +++ b/riocli/device/deployment.py @@ -13,19 +13,17 @@ # limitations under the License. import click from click_help_colors import HelpColorsCommand -from rapyuta_io.clients.deployment import DeploymentPhaseConstants -from riocli.config import new_client +from riocli.config import new_v2_client from riocli.constants import Colors from riocli.deployment.list import display_deployment_list from riocli.device.util import name_to_guid -PHASES = [ - DeploymentPhaseConstants.INPROGRESS, - DeploymentPhaseConstants.PROVISIONING, - DeploymentPhaseConstants.SUCCEEDED, - DeploymentPhaseConstants.FAILED_TO_START, - DeploymentPhaseConstants.PARTIALLY_DEPROVISIONED, +DEFAULT_PHASES = [ + 'InProgress', + 'Provisioning', + 'Succeeded', + 'FailedToStart', ] @@ -38,12 +36,10 @@ @click.argument('device-name', type=str) @name_to_guid def list_deployments(device_name: str, device_guid: str) -> None: - """ - Lists all the deployments running on the Device - """ + """Lists all the deployments running on the device.""" try: - client = new_client() - deployments = client.get_all_deployments(device_id=device_guid, phases=PHASES) + client = new_v2_client() + deployments = client.list_deployments(query={'deviceName': device_name, 'phases': DEFAULT_PHASES}) display_deployment_list(deployments, show_header=True) except Exception as e: click.secho(str(e), fg=Colors.RED)