From 7891a5c5b863fb74746a0a84e5dfbc871c07d017 Mon Sep 17 00:00:00 2001 From: Smruti Ranjan Senapati Date: Wed, 17 Jul 2024 14:50:50 +0530 Subject: [PATCH] fix(deployments): adds stopped at time for deployment list --- riocli/deployment/list.py | 10 ++-------- riocli/v2client/client.py | 13 ++++++------- riocli/v2client/enums.py | 2 -- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/riocli/deployment/list.py b/riocli/deployment/list.py index f2b590ab..bfdc1cc9 100644 --- a/riocli/deployment/list.py +++ b/riocli/deployment/list.py @@ -28,16 +28,12 @@ DeploymentPhaseConstants.DeploymentPhaseProvisioning, DeploymentPhaseConstants.DeploymentPhaseSucceeded, DeploymentPhaseConstants.DeploymentPhaseStopped, - DeploymentPhaseConstants.DeploymentPhaseFailedToStart, - DeploymentPhaseConstants.DeploymentPhaseFailedToUpdate, ] DEFAULT_PHASES = [ DeploymentPhaseConstants.DeploymentPhaseInProgress, DeploymentPhaseConstants.DeploymentPhaseProvisioning, DeploymentPhaseConstants.DeploymentPhaseSucceeded, - DeploymentPhaseConstants.DeploymentPhaseFailedToStart, - DeploymentPhaseConstants.DeploymentPhaseFailedToUpdate ] @@ -80,15 +76,13 @@ def display_deployment_list( ): headers = [] if show_header: - headers = ('Name', 'Status', 'Phase', 'Errors') - if wide: - headers += ('Package', 'Deployment ID',) + headers = ('Deployment ID', 'Name', 'Phase', 'Package', 'Creation Time (UTC)', 'Stopped Time (UTC)') data = [] for deployment in deployments: package_name_version = "{} ({})".format(deployment.metadata.depends.nameOrGUID, deployment.metadata.depends.version) phase = deployment.status.phase if deployment.status else "" data.append([deployment.metadata.guid, deployment.metadata.name, - phase, package_name_version]) + phase, package_name_version, deployment.metadata.createdAt, deployment.metadata.get('deletedAt')]) tabulate_data(data, headers=headers) diff --git a/riocli/v2client/client.py b/riocli/v2client/client.py index a035aa66..44d5ac39 100644 --- a/riocli/v2client/client.py +++ b/riocli/v2client/client.py @@ -930,15 +930,13 @@ def list_deployments( url = "{}/v2/deployments/".format(self._host) headers = self._config.get_auth_header() - params = {} + params = { + "continue": 0, + "limit": 100, + } params.update(query or {}) - offset, result = 0, [] + result = [] while True: - params.update({ - "continue": offset, - "limit": 50, - "phases": ["Succeeded", "InProgress", "Provisioning", "FailedToUpdate", "FailedToStart"], - }) response = RestClient(url).method(HttpMethod.GET).query_param( params).headers(headers).execute() data = json.loads(response.text) @@ -949,6 +947,7 @@ def list_deployments( if not deployments: break offset = data['metadata']['continue'] + params.update({"continue": offset}) result.extend(deployments) return munchify(result) diff --git a/riocli/v2client/enums.py b/riocli/v2client/enums.py index 1a7435fa..90166f18 100644 --- a/riocli/v2client/enums.py +++ b/riocli/v2client/enums.py @@ -12,8 +12,6 @@ def __str__(self): DeploymentPhaseInProgress = "InProgress" DeploymentPhaseProvisioning = "Provisioning" DeploymentPhaseSucceeded = "Succeeded" - DeploymentPhaseFailedToUpdate = "FailedToUpdate" - DeploymentPhaseFailedToStart = "FailedToStart" DeploymentPhaseStopped = "Stopped"