Skip to content

Commit

Permalink
Clients: Intoduced new constraint rucio#6091
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwaizer authored and bari12 committed Sep 27, 2023
1 parent a55d365 commit fc3973a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/rucio/web/rest/flaskapi/v1/dids.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
resurrect, get_users_following_did, remove_did_from_followed, add_did_to_followed, delete_metadata, \
set_metadata_bulk, set_dids_metadata_bulk
from rucio.api.rule import list_replication_rules, list_associated_replication_rules_for_file
from rucio.common.exception import ScopeNotFound, DataIdentifierNotFound, DataIdentifierAlreadyExists, \
from rucio.common.exception import ScopeNotFound, DatabaseException, DataIdentifierNotFound, DataIdentifierAlreadyExists, \
DuplicateContent, AccessDenied, KeyNotFound, Duplicate, InvalidValueForKey, UnsupportedStatus, \
UnsupportedOperation, RSENotFound, RuleNotFound, InvalidMetadata, InvalidPath, FileAlreadyExists, InvalidObject, FileConsistencyMismatch
from rucio.common.utils import render_json, APIEncoder
Expand Down Expand Up @@ -655,6 +655,15 @@ def post(self, scope_name):
return generate_http_error_flask(409, error)
except AccessDenied as error:
return generate_http_error_flask(401, error)
except DatabaseException as error:
if 'DELETED_DIDS_PK violated' in str(error):
return generate_http_error_flask(
status_code=406,
exc=error.__class__.__name__,
exc_msg=str('A deleted DID {} with scope {} is reused'.format(name, scope))
)
else:
return generate_http_error_flask(406, error)

return 'Created', 201

Expand Down

0 comments on commit fc3973a

Please sign in to comment.