diff --git a/ads/common/dsc_file_system.py b/ads/common/dsc_file_system.py index 2d536469b..ecd3de8ca 100644 --- a/ads/common/dsc_file_system.py +++ b/ads/common/dsc_file_system.py @@ -204,10 +204,14 @@ def update_from_dsc_model(cls, dsc_model) -> dict: raise ValueError( "Missing parameter `destination_directory_name` from service. Check service log to see the error." ) + + dest = dsc_model.destination_directory_name + if dsc_model.destination_path: + dest = f"{dsc_model.destination_path.rstrip('/')}/{dsc_model.destination_directory_name}" return { "src" : f"{dsc_model.mount_target_id}:{dsc_model.export_id}", - "dest" : f"{(dsc_model.destination_path or '').rstrip('/')}/{dsc_model.destination_directory_name}" + "dest" : dest } @dataclass @@ -249,9 +253,13 @@ def update_from_dsc_model(cls, dsc_model) -> dict: "Missing parameter `destination_directory_name` from service. Check service log to see the error." ) + dest = dsc_model.destination_directory_name + if dsc_model.destination_path: + dest = f"{dsc_model.destination_path.rstrip('/')}/{dsc_model.destination_directory_name}" + return { "src" : f"oci://{dsc_model.bucket}@{dsc_model.namespace}/{dsc_model.prefix or ''}", - "dest" : f"{(dsc_model.destination_path or '').rstrip('/')}/{dsc_model.destination_directory_name}" + "dest" : dest } diff --git a/tests/unitary/default_setup/jobs/test_jobs_mount_file_system.py b/tests/unitary/default_setup/jobs/test_jobs_mount_file_system.py index cacaae5d3..fe7aaf80b 100644 --- a/tests/unitary/default_setup/jobs/test_jobs_mount_file_system.py +++ b/tests/unitary/default_setup/jobs/test_jobs_mount_file_system.py @@ -532,7 +532,7 @@ def test_dsc_file_storage_error(self): def test_get_destination_path_and_name(self): path, directory = OCIFileStorage.get_destination_path_and_name("abc") - assert path == "" + assert path == None assert directory == "abc" path, directory = OCIFileStorage.get_destination_path_and_name("/abc")