Skip to content

Commit f90d362

Browse files
committed
squashme: address comments
1 parent 73758f6 commit f90d362

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

components/renku_data_services/notebooks/api.spec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,11 +1022,12 @@ components:
10221022
storage_id:
10231023
allOf:
10241024
- "$ref": "#/components/schemas/Ulid"
1025-
- description: If the storage_id is provided then this config must replace an existing storage config in the session
1025+
- description: The storage ID is used to know which storage config from the DB should be overriden
10261026
required:
10271027
- configuration
10281028
- source_path
10291029
- target_path
1030+
- storage_id
10301031
ServerName:
10311032
type: string
10321033
minLength: 5

components/renku_data_services/notebooks/apispec.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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
@@ -847,14 +847,18 @@ async def _handler(
847847
name=None,
848848
)
849849
for s in body.cloudstorage or []
850-
if s.storage_id is not None
851850
}
852851
# NOTE: Check the cloud storage in the request body and if any match
853852
# then overwrite the projects cloud storages
854-
# NOTE: Cloud storages in the session launch request body that are not form the DB are ignored
853+
# NOTE: Cloud storages in the session launch request body that are not form the DB will cause a 422 error
855854
for csr_id, csr in cloud_storage_request.items():
856-
if csr_id in cloud_storage:
857-
cloud_storage[csr_id] = csr
855+
if csr_id not in cloud_storage:
856+
raise errors.MissingResourceError(
857+
message=f"You have requested a cloud storage with ID {csr_id} which does not exist "
858+
"or you dont have access to.",
859+
quiet=True,
860+
)
861+
cloud_storage[csr_id] = csr
858862
# repositories = [Repository(i.url, branch=i.branch, commit_sha=i.commit_sha) for i in body.repositories]
859863
repositories = [Repository(url=i) for i in project.repositories]
860864
secrets_to_create: list[V1Secret] = []
@@ -877,7 +881,7 @@ async def _handler(
877881
is_image_private=False,
878882
internal_gitlab_user=internal_gitlab_user,
879883
)
880-
# Generate the cloud starge secrets
884+
# Generate the cloud storage secrets
881885
data_sources: list[DataSource] = []
882886
for ics, cs in enumerate(cloud_storage.values()):
883887
secret_name = f"{server_name}-ds-{ics}"

0 commit comments

Comments
 (0)