Skip to content

Commit

Permalink
validate_allocations: handle institution-specific code
Browse files Browse the repository at this point in the history
  • Loading branch information
jtriley committed Jan 22, 2024
1 parent fb52550 commit 663b9b5
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ def sync_users(project_id, allocation, allocator, apply):

return failed_validation

def check_institution_specific_code(self, allocation):
attr = attributes.ALLOCATION_INSTITUTION_SPECIFIC_CODE
isc = allocation.get_attribute(attr)
if not isc:
utils.set_attribute_on_allocation(
allocation, attr, "UNSET"
)

def handle(self, *args, **options):

# Openstack Resources first
Expand All @@ -64,6 +72,7 @@ def handle(self, *args, **options):
status=AllocationStatusChoice.objects.get(name='Active')
)
for allocation in openstack_allocations:
self.check_institution_specific_code(allocation)
allocation_str = f'{allocation.pk} of project "{allocation.project.title}"'
msg = f'Starting resource validation for allocation {allocation_str}.'
logger.debug(msg)
Expand Down Expand Up @@ -134,6 +143,7 @@ def handle(self, *args, **options):
)

for allocation in openshift_allocations:
self.check_institution_specific_code(allocation)
allocation_str = f'{allocation.pk} of project "{allocation.project.title}"'
logger.debug(
f"Starting resource validation for allocation {allocation_str}."
Expand Down

0 comments on commit 663b9b5

Please sign in to comment.