Skip to content

Commit

Permalink
fix: renable s3 customizations for data connectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Panaetius committed Jan 14, 2025
1 parent fce24d6 commit f4e237c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/renku_data_services/storage/rclone.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,14 @@ def __patch_schema_remove_oauth_propeties(spec: list[dict[str, Any]]) -> None:

@staticmethod
def __find_storage(spec: list[dict[str, Any]], prefix: str) -> dict[str, Any]:
"""Find and return the WebDAV storage schema from the spec."""
"""Find and return the storage schema from the spec.
This returns the original entry for in-place modification.
"""
storage = next((s for s in spec if s["Prefix"] == prefix), None)
if not storage:
raise errors.ValidationError(message=f"'{prefix}' storage not found in schema.")
return deepcopy(storage)
return storage

@staticmethod
def __add_webdav_based_storage(
Expand All @@ -176,7 +179,7 @@ def __add_webdav_based_storage(
) -> None:
"""Create a modified copy of WebDAV storage and add it to the schema."""
# Find WebDAV storage schema and create a modified copy
storage_copy = RCloneValidator.__find_storage(spec, "webdav")
storage_copy = deepcopy(RCloneValidator.__find_storage(spec, "webdav"))
storage_copy.update({"Prefix": prefix, "Name": name, "Description": description})

custom_options = [
Expand Down
1 change: 1 addition & 0 deletions test/bases/renku_data_services/data_api/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,3 +600,4 @@ async def test_storage_schema(storage_test_client) -> None:
providers = next(p for p in s3["options"] if p["name"] == "provider")
assert providers
assert providers.get("examples")
assert any(e["value"] == "Switch" for e in providers.get("examples"))

0 comments on commit f4e237c

Please sign in to comment.