Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: renable s3 customizations for data connectors #606

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be better to have one test per patch in the future.

Loading