diff --git a/src/coldfront_plugin_cloud/management/commands/validate_allocations.py b/src/coldfront_plugin_cloud/management/commands/validate_allocations.py index 4e20ab6..b6d60a2 100644 --- a/src/coldfront_plugin_cloud/management/commands/validate_allocations.py +++ b/src/coldfront_plugin_cloud/management/commands/validate_allocations.py @@ -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 @@ -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) @@ -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}."