Skip to content

Commit

Permalink
miscellaneous bugfixes (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters authored Feb 14, 2024
1 parent 072a65f commit 294811f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions coldfront/core/allocation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2027,6 +2027,7 @@ def post(self, request, *args, **kwargs):
# require nese shares to be divisible by 20
if formset_data['name'] == 'Storage Quota (TB)':
try:
new_value = re.sub('\.0$', '', new_value)
tbs = int(new_value)
except ValueError:
messages.error(request, 'Requested storage quota must be an integer.')
Expand Down
2 changes: 2 additions & 0 deletions coldfront/plugins/sftocf/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
def pull_sf_push_cf():
management.call_command('pull_sf_push_cf')

def update_zones():
management.call_command('update_zones')

def pull_resource_data():
utils.pull_resource_data()
12 changes: 8 additions & 4 deletions coldfront/plugins/sftocf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,11 +571,12 @@ def __init__(self, volume=None):
if volume:
self.volumes = [volume]
else:
self.volumes = self.connection_obj.get_corresponding_coldfront_resources()
resources = self.connection_obj.get_corresponding_coldfront_resources()
self.volumes = [r.name.split('/')[0] for r in resources]

self.allocations = Allocation.objects.filter(
status__name__in=['Active', 'New', 'Updated', 'Ready for Review'],
resources__in=self.volumes
resources__in=resources
)
# self.collection_filter = self.set_collection_parameters()
self.sf_user_data = self.collect_sf_user_data()
Expand Down Expand Up @@ -973,8 +974,11 @@ def pull_resource_data(source='rest_api'):
res_attr_types = ResourceAttributeType.objects.all()

for volume in volumes:
resource = Resource.objects.get(name__contains=volume['name'])

try:
resource = Resource.objects.get(name__contains=volume['name'])
except Exception as e:
logger.error("error encountered with pull_resource_data resource location: %s", e)
continue
for attr_name, attr_val in volume['attrs'].items():
if attr_val:
attr_type_obj = res_attr_types.get(name=attr_name)
Expand Down

0 comments on commit 294811f

Please sign in to comment.