aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Smith <ssmith@iol.unh.edu>2020-08-24 15:02:27 -0400
committerSean Smith <ssmith@iol.unh.edu>2020-08-24 15:17:26 -0400
commita6befd926b6b80505bd857d9b6c83f9c7501232f (patch)
tree451e77ea01d380cdec50e903692fe4d1a8d0ab12
parent90a55772df44dfaeadced5fb3dc4dab0c9c49c6f (diff)
Fix non allocation issues
Signed-off-by: Sean Smith <ssmith@iol.unh.edu> Change-Id: Ifcd47f8f5e00940ec472ab13fa0b3371c77a9cb7
-rw-r--r--src/resource_inventory/models.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/resource_inventory/models.py b/src/resource_inventory/models.py
index c918513..fd2ef9d 100644
--- a/src/resource_inventory/models.py
+++ b/src/resource_inventory/models.py
@@ -12,6 +12,7 @@ from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q
+import traceback
import re
from collections import Counter
@@ -201,10 +202,20 @@ class ResourceBundle(models.Model):
def release(self):
for pn in PhysicalNetwork.objects.filter(bundle=self).all():
- pn.release()
+ try:
+ pn.release()
+ except Exception as e:
+ print("Exception occurred while trying to release resource ", pn.valid_id)
+ print(e)
+ traceback.print_exc()
for resource in self.get_resources():
- resource.release()
+ try:
+ resource.release()
+ except Exception as e:
+ print("Exception occurred while trying to release resource ", resource)
+ print(e)
+ traceback.print_exc()
def get_template_name(self):
if not self.template:
@@ -343,6 +354,7 @@ class Server(Resource):
return list(self.interfaces.all().order_by('bus_address'))
def release(self):
+ self.bundle = None
self.booked = False
self.save()