Fix copy of OKA package to PVC for OKA creation 94/14594/4
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 24 Sep 2024 12:48:12 +0000 (14:48 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Thu, 26 Sep 2024 09:39:10 +0000 (11:39 +0200)
Change-Id: Ibf02828d969fe51749248a090dfbaab47a0d30e5
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
osm_lcm/odu_libs/oka.py

index 509733e..ff247ea 100644 (file)
@@ -17,7 +17,6 @@
 
 
 import yaml
-from osm_lcm.lcm_utils import LcmException
 
 
 async def create_oka(self, op_id, op_params, content):
@@ -37,16 +36,19 @@ async def create_oka(self, op_id, op_params, content):
     oka_folder = f"{oka_fs_info['path']}{oka_fs_info['folder']}"
     oka_filename = oka_fs_info["zipfile"]
     self.fs.sync(oka_folder)
-    if not self.fs.file_exists(f"{oka_folder}/{oka_filename}"):
-        raise LcmException(message="Not able to find oka", bad_args=["oka_path"])
+    self.logger.info("OKA Folder: {} OKA filename: {}".format(oka_folder, oka_filename))
+    # TODO: check if file exists
+    # if not self.fs.file_exists(f"{oka_folder}/{oka_filename}"):
+    #     raise LcmException(message="Not able to find oka", bad_args=["oka_path"])
+    self.logger.debug("Processing....")
 
     # Create temporary volume for the OKA package and copy the content
     temp_volume_name = f"temp-pvc-oka-{op_id}"
     await self._kubectl.create_pvc_with_content(
         name=temp_volume_name,
         namespace="osm-workflows",
-        src_folder=oka_folder,
-        filename=oka_filename,
+        src_file=f"{oka_folder}/{oka_filename}",
+        dest_filename=f"{oka_name}.tar.gz",
     )
 
     # Render workflow