@@ -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