Skip to content

Commit

Permalink
Core & Internals: naming_convention, check scope attributes exist bef…
Browse files Browse the repository at this point in the history
…ore accessing them
  • Loading branch information
rdimaio authored and bari12 committed Apr 26, 2024
1 parent 639e29c commit 40135a0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/rucio/core/naming_convention.py
Expand Up @@ -119,18 +119,20 @@ def validate_name(scope, name, did_type, *, session: "Session"):
:returns: a dictionary with metadata.
"""
if scope.external.startswith('user'):
return {'project': 'user'}
elif scope.external.startswith('group'):
return {'project': 'group'}
if scope.external is not None:
if scope.external.startswith('user'):
return {'project': 'user'}
elif scope.external.startswith('group'):
return {'project': 'group'}

# Check if naming convention can be found in cache region
regexp = REGION.get(scope.internal)
if regexp is NO_VALUE: # no cached entry found
regexp = get_naming_convention(scope=scope,
convention_type=KeyType.DATASET,
session=session)
regexp and REGION.set(scope.internal, regexp)
if scope.internal is not None:
regexp and REGION.set(scope.internal, regexp)

if not regexp:
return
Expand Down

0 comments on commit 40135a0

Please sign in to comment.