Skip to content

Commit

Permalink
fix(deployments): adds stopped at time for deployment list
Browse files Browse the repository at this point in the history
  • Loading branch information
smrutisenapati authored and pallabpain committed Sep 4, 2024
1 parent e0ef5ed commit 7891a5c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
10 changes: 2 additions & 8 deletions riocli/deployment/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]


Expand Down Expand Up @@ -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)
13 changes: 6 additions & 7 deletions riocli/v2client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions riocli/v2client/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ def __str__(self):
DeploymentPhaseInProgress = "InProgress"
DeploymentPhaseProvisioning = "Provisioning"
DeploymentPhaseSucceeded = "Succeeded"
DeploymentPhaseFailedToUpdate = "FailedToUpdate"
DeploymentPhaseFailedToStart = "FailedToStart"
DeploymentPhaseStopped = "Stopped"


Expand Down

0 comments on commit 7891a5c

Please sign in to comment.