Skip to content

Commit fa13825

Browse files
committed
squashme: address comments
1 parent a4d2e26 commit fa13825

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

components/renku_data_services/notebooks/api.spec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,11 +1025,12 @@ components:
10251025
storage_id:
10261026
allOf:
10271027
- "$ref": "#/components/schemas/Ulid"
1028-
- description: If the storage_id is provided then this config must replace an existing storage config in the session
1028+
- description: The storage ID is used to know which storage config from the DB should be overriden
10291029
required:
10301030
- configuration
10311031
- source_path
10321032
- target_path
1033+
- storage_id
10331034
ServerName:
10341035
type: string
10351036
minLength: 5

components/renku_data_services/notebooks/apispec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: api.spec.yaml
3-
# timestamp: 2024-09-23T14:43:54+00:00
3+
# timestamp: 2024-09-23T15:38:59+00:00
44

55
from __future__ import annotations
66

@@ -263,8 +263,8 @@ class SessionCloudStoragePost(BaseAPISpec):
263263
readonly: bool = True
264264
source_path: str
265265
target_path: str
266-
storage_id: Optional[str] = Field(
267-
None,
266+
storage_id: str = Field(
267+
...,
268268
description="ULID identifier",
269269
max_length=26,
270270
min_length=26,

components/renku_data_services/notebooks/blueprints.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -835,14 +835,18 @@ async def _handler(
835835
name=None,
836836
)
837837
for s in body.cloudstorage or []
838-
if s.storage_id is not None
839838
}
840839
# NOTE: Check the cloud storage in the request body and if any match
841840
# then overwrite the projects cloud storages
842-
# NOTE: Cloud storages in the session launch request body that are not form the DB are ignored
841+
# NOTE: Cloud storages in the session launch request body that are not form the DB will cause a 422 error
843842
for csr_id, csr in cloud_storage_request.items():
844-
if csr_id in cloud_storage:
845-
cloud_storage[csr_id] = csr
843+
if csr_id not in cloud_storage:
844+
raise errors.MissingResourceError(
845+
message=f"You have requested a cloud storage with ID {csr_id} which does not exist "
846+
"or you dont have access to.",
847+
quiet=True,
848+
)
849+
cloud_storage[csr_id] = csr
846850
# repositories = [Repository(i.url, branch=i.branch, commit_sha=i.commit_sha) for i in body.repositories]
847851
repositories = [Repository(url=i) for i in project.repositories]
848852
secrets_to_create: list[V1Secret] = []
@@ -865,7 +869,7 @@ async def _handler(
865869
is_image_private=False,
866870
internal_gitlab_user=internal_gitlab_user,
867871
)
868-
# Generate the cloud starge secrets
872+
# Generate the cloud storage secrets
869873
data_sources: list[DataSource] = []
870874
for ics, cs in enumerate(cloud_storage.values()):
871875
secret_name = f"{server_name}-ds-{ics}"

0 commit comments

Comments
 (0)