From ee6c3b93776e37d02b3334c2281ec2b86d191723 Mon Sep 17 00:00:00 2001 From: Raymond Wiker Date: Thu, 19 Dec 2024 13:32:40 +0100 Subject: [PATCH] Use case-specific, shared access key for uploading child objects into sumo. --- src/fmu/sumo/uploader/_sumocase.py | 4 +++- src/fmu/sumo/uploader/caseondisk.py | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/fmu/sumo/uploader/_sumocase.py b/src/fmu/sumo/uploader/_sumocase.py index 3334988..0cdc1d3 100644 --- a/src/fmu/sumo/uploader/_sumocase.py +++ b/src/fmu/sumo/uploader/_sumocase.py @@ -86,10 +86,12 @@ def upload(self, threads=4): logger.debug("files_to_upload: %s", files_to_upload) + sumoclient = self.sumoclient.client_for_case(self._sumo_parent_id) + upload_results = upload_files( files_to_upload, self._sumo_parent_id, - self.sumoclient, + sumoclient, threads, self.sumo_mode, self.config_path, diff --git a/src/fmu/sumo/uploader/caseondisk.py b/src/fmu/sumo/uploader/caseondisk.py index ccdc336..b1a3a22 100644 --- a/src/fmu/sumo/uploader/caseondisk.py +++ b/src/fmu/sumo/uploader/caseondisk.py @@ -156,6 +156,14 @@ def register(self): sumo_parent_id = self._upload_case_metadata(self.case_metadata) self._sumo_parent_id = sumo_parent_id + try: + self.sumoclient.create_shared_access_key_for_case( + self._fmu_case_uuid + ) + except Exception as ex: + logger.warn(f"Unable to create shared access key: {ex}") + pass + logger.info("Case registered. SumoID: {}".format(sumo_parent_id)) return sumo_parent_id