Allow project creation when GCS fails.
Without this exception handler, the project would be invalid, as the after_inserting_project() hook would be half-run.
This commit is contained in:
parent
9ed73eb7dd
commit
8dc4ac0db7
@ -178,11 +178,14 @@ def after_inserting_project(project, db_user):
|
||||
if current_app.config.get('TESTING'):
|
||||
log.warning('Not creating Google Cloud Storage bucket while running unit tests!')
|
||||
else:
|
||||
try:
|
||||
gcs_storage = GoogleCloudStorageBucket(str(project_id))
|
||||
if gcs_storage.bucket.exists():
|
||||
log.info('Created CGS instance for project %s', project_id)
|
||||
log.info('Created GCS instance for project %s', project_id)
|
||||
else:
|
||||
log.warning('Unable to create CGS instance for project %s', project_id)
|
||||
log.warning('Unable to create GCS instance for project %s', project_id)
|
||||
except gcs_exceptions.Forbidden as ex:
|
||||
log.warning('GCS forbids me to create CGS instance for project %s: %s', project_id, ex)
|
||||
|
||||
# Commit the changes directly to the MongoDB; a PUT is not allowed yet,
|
||||
# as the project doesn't have a valid permission structure.
|
||||
|
Loading…
x
Reference in New Issue
Block a user