From b0e75eea8bb7dbcbf9cf6d589e03029a63f16ac3 Mon Sep 17 00:00:00 2001 From: Mohammad Alisafaee Date: Thu, 11 Jul 2024 01:06:39 +0200 Subject: [PATCH] refactor --- renku_notebooks/api/classes/data_service.py | 2 +- renku_notebooks/api/notebooks.py | 4 ++-- renku_notebooks/api/schemas/cloud_storage.py | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/renku_notebooks/api/classes/data_service.py b/renku_notebooks/api/classes/data_service.py index 2deab18c..48736d5c 100644 --- a/renku_notebooks/api/classes/data_service.py +++ b/renku_notebooks/api/classes/data_service.py @@ -56,7 +56,7 @@ def get_storage_by_id(self, user: User, endpoint: str, storage_id: str) -> Cloud ) response = res.json() storage = response["storage"] - secrets = {s["name"]: s["secret_id"] for s in response["secrets"]} if "secrets" in response else {} + secrets = {s["secret_id"]: s["name"] for s in response["secrets"]} if "secrets" in response else {} return CloudStorageConfig( config=storage["configuration"], source_path=storage["source_path"], diff --git a/renku_notebooks/api/notebooks.py b/renku_notebooks/api/notebooks.py index 369ce6a5..abdaa886 100644 --- a/renku_notebooks/api/notebooks.py +++ b/renku_notebooks/api/notebooks.py @@ -510,9 +510,9 @@ def _on_error(error_msg): request_data = { "name": f"{cloud_storage.base_name}-saved-storage-secrets", "namespace": server.k8s_client.preferred_namespace, - "secret_ids": list(cloud_storage.secrets.values()), + "secret_ids": list(cloud_storage.secrets), "owner_references": [owner_reference], - "keys_property": "id", + "key_mapping": cloud_storage.secrets, } try: diff --git a/renku_notebooks/api/schemas/cloud_storage.py b/renku_notebooks/api/schemas/cloud_storage.py index 9a44a47c..5cab1a20 100644 --- a/renku_notebooks/api/schemas/cloud_storage.py +++ b/renku_notebooks/api/schemas/cloud_storage.py @@ -1,6 +1,5 @@ """Schema for cloudstorage config.""" -import json from configparser import ConfigParser from io import StringIO from pathlib import Path @@ -123,7 +122,6 @@ def get_manifest_patch(self, base_name: str, namespace: str, labels={}, annotati "stringData": { "remote": self.name or base_name, "remotePath": self.source_path, - "secrets": json.dumps(self.secrets), "secretKey": self.user_secret_key, "configData": self.config_string(self.name or base_name), },