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