Skip to content

Commit

Permalink
Updated pr.
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-ohai committed Oct 10, 2023
1 parent 68d4b59 commit cadbab1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions ads/common/dsc_file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit cadbab1

Please sign in to comment.