-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add polybox storage #527
Conversation
You can access the deployment of this PR at https://renku-ci-ds-527.dev.renku.ch |
bd555db
to
f567310
Compare
f567310
to
2896ebc
Compare
2896ebc
to
aadc15c
Compare
aadc15c
to
df5e967
Compare
df5e967
to
df14d60
Compare
df14d60
to
f0e351d
Compare
f0e351d
to
dfa1925
Compare
dfa1925
to
e6dd8cf
Compare
e6dd8cf
to
83b1acb
Compare
9a4b60d
to
207b3d4
Compare
207b3d4
to
9c4f0a7
Compare
f4a6f1d
to
26c6e3c
Compare
26c6e3c
to
578240d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this looks really good, there's just some issues related to idiosyncracies of the rlcone schema.
if access == "shared" and storage_type == "switchDrive": | ||
self.configuration["url"] = "https://drive.switch.ch/public.php/webdav/" | ||
if access == "personal" and storage_type == "polybox": | ||
self.configuration["url"] = "https://polybox.ethz.ch/remote.php/webdav/" | ||
if access == "personal" and storage_type == "switchDrive": | ||
self.configuration["url"] = "https://drive.switch.ch/remote.php/webdav/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: these should be elif
since they're mutually exclusive.
@@ -156,6 +157,91 @@ def __patch_schema_remove_oauth_propeties(spec: list[dict[str, Any]]) -> None: | |||
options.append(option) | |||
storage["Options"] = options | |||
|
|||
@staticmethod | |||
def __find_webdav_storage(spec: list[dict[str, Any]]) -> dict[str, Any]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: this is too specific to me, I think having _find_storage(prefix: str)
would be cleaner and there might be some other places where we could use that as well,e.g. in __patch_schema_add_switch_provider
"IsPassword": False, | ||
"NoPrefix": False, | ||
"Advanced": False, | ||
"Exclusive": False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: Exclusive
should be True
, this means that only the values in Examples
are valid values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thanks for clarify that
"Provider": "", | ||
}, | ||
], | ||
"Required": False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: this field is mandatory, no? Especially since it doesn't have a default set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it is
|
||
custom_options = [ | ||
{ | ||
"Name": "access", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: I'm a bit confused by this, this is a field called access, but lower down its values are used as provider. In rclone schemas, the providers should be in the field provider
by convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see where the confusion came from. I was trying to make it flexible by adding an option for access (personal and shared), but it ended up being a bit unclear. I’ll change it so the modes are set in the provider options instead, and I’ll use the provider property to specify when an option applies to a specific mode (personal or shared).
- make __find_webdav_storage as more reusable function - use provider option for set the personal and shared modes instead of creating an option for it - clean up code
@@ -176,36 +176,10 @@ 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_webdav_storage(spec) | |||
storage_copy = RCloneValidator.__find_storage(spec, "webDav") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storage_copy = RCloneValidator.__find_storage(spec, "webDav") | |
storage_copy = RCloneValidator.__find_storage(spec, "webdav") |
I think this is a typo? at least it was lower case before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it is. thanks!
eaad207
to
9a58d06
Compare
|
||
# Transform configuration for polybox or switchDrive | ||
storage_type = self.configuration.get("type", "") | ||
access = self.configuration.get("provider", "") | ||
|
||
if storage_type == "polybox" or storage_type == "switchDrive": | ||
self.configuration["type"] = "webdav" | ||
self.configuration["provider"] = "" | ||
|
||
if access == "shared" and storage_type == "polybox": | ||
self.configuration["url"] = "https://polybox.ethz.ch/public.php/webdav/" | ||
elif access == "shared" and storage_type == "switchDrive": | ||
self.configuration["url"] = "https://drive.switch.ch/public.php/webdav/" | ||
elif access == "personal" and storage_type == "polybox": | ||
self.configuration["url"] = "https://polybox.ethz.ch/remote.php/webdav/" | ||
elif access == "personal" and storage_type == "switchDrive": | ||
self.configuration["url"] = "https://drive.switch.ch/remote.php/webdav/" | ||
|
||
# Extract the user from the public link | ||
if access == "shared" and storage_type in {"polybox", "switchDrive"}: | ||
public_link = self.configuration.get("public_link", "") | ||
user_identifier = public_link.split("/")[-1] | ||
self.configuration["user"] = user_identifier | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just as a reminder, these changes also need to be backported to https://github.com/SwissDataScienceCenter/renku-notebooks/blob/master/renku_notebooks/api/schemas/cloud_storage.py#L155 to work with Renku v1.
Tearing down the temporary RenkuLab deplyoment for this PR. |
PR to modify cloud storage schema to add polybox storage
/deploy