From 34b5c0b6fe8300154b69963db46e9c70cb9a4a1e Mon Sep 17 00:00:00 2001 From: RomilShah Date: Mon, 20 May 2024 23:19:56 +0530 Subject: [PATCH] fix(secret): corrects corresponding list functions (#310) Due to a recent refactor in the v2 client library, the list secrets function now returns the entire secret objects instead of just reading the metadata in the previous implementation. This changed object altogther and the way other sections of code fetched the secret name. This commit addresses the issue by correcting the list_secrets function. --- riocli/secret/list.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/riocli/secret/list.py b/riocli/secret/list.py index e090ec53..4e312a68 100644 --- a/riocli/secret/list.py +++ b/riocli/secret/list.py @@ -34,7 +34,7 @@ def list_secrets() -> None: try: client = new_v2_client(with_project=True) secrets = client.list_secrets() - secrets = sorted(secrets, key=lambda s: s.name.lower()) + secrets = sorted(secrets, key=lambda s: s.metadata.name.lower()) _display_secret_list(secrets, show_header=True) except Exception as e: click.secho(str(e), fg=Colors.RED) @@ -49,7 +49,7 @@ def _display_secret_list( if show_header: headers = ('ID', 'Name', 'Created At', 'Creator') - data = [ [secret.guid, secret.name, - secret.createdAt, secret.creatorGUID] for secret in secrets ] + data = [ [secret.metadata.guid, secret.metadata.name, + secret.metadata.createdAt, secret.metadata.creatorGUID] for secret in secrets ] tabulate_data(data, headers)