aboutsummaryrefslogtreecommitdiffstats
path: root/src/workflow
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2018-11-20 11:19:55 -0500
committerParker Berberian <pberberian@iol.unh.edu>2018-11-26 14:14:10 -0500
commitb361d6df77ab59bb0f227aec00c19b080f31bc50 (patch)
tree0aa043dcd4701ab22385b2eca2e783f27de687fd /src/workflow
parentb7c4d286ffa618be0e95b15f3883e2f6920a3fb1 (diff)
Fixed Misc Bugs
Some corner cases that cause issues recently came to our attention. Fixes issues in the booking workflow and the Notification system. Change-Id: Ie16118ba1bdbeff86bb41a16dc783337b921d527 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
Diffstat (limited to 'src/workflow')
-rw-r--r--src/workflow/resource_bundle_workflow.py8
-rw-r--r--src/workflow/sw_bundle_workflow.py10
2 files changed, 16 insertions, 2 deletions
diff --git a/src/workflow/resource_bundle_workflow.py b/src/workflow/resource_bundle_workflow.py
index 9fb4ae1..712c92b 100644
--- a/src/workflow/resource_bundle_workflow.py
+++ b/src/workflow/resource_bundle_workflow.py
@@ -35,7 +35,8 @@ from dashboard.exceptions import (
InvalidVlanConfigurationException,
NetworkExistsException,
InvalidHostnameException,
- NonUniqueHostnameException
+ NonUniqueHostnameException,
+ ResourceAvailabilityException
)
import logging
@@ -233,6 +234,8 @@ class Define_Nets(WorkflowStep):
self.updateModels(xmlData)
# update model with xml
self.metastep.set_valid("Networks applied successfully")
+ except ResourceAvailabilityException:
+ self.metastep.set_invalid("Public network not availble")
except Exception:
self.metastep.set_invalid("An error occurred when applying networks")
return self.render(request)
@@ -261,6 +264,9 @@ class Define_Nets(WorkflowStep):
vlan_id = network['network']['vlan']
is_public = network['network']['public']
if is_public:
+ public_net = vlan_manager.get_public_vlan()
+ if public_net is None:
+ raise ResourceAvailabilityException("No public networks available")
vlan_id = vlan_manager.get_public_vlan().vlan
vlan = Vlan(vlan_id=vlan_id, tagged=network['tagged'], public=is_public)
models['vlans'][existing_host.resource.name][iface['profile_name']].append(vlan)
diff --git a/src/workflow/sw_bundle_workflow.py b/src/workflow/sw_bundle_workflow.py
index 56d0a5d..26ade22 100644
--- a/src/workflow/sw_bundle_workflow.py
+++ b/src/workflow/sw_bundle_workflow.py
@@ -69,7 +69,15 @@ class Define_Software(WorkflowStep):
user = self.repo_get(self.repo.SESSION_USER)
i = 0
for host_data in hosts_initial:
- host = GenericHost.objects.get(pk=host_data['host_id'])
+ host_profile = None
+ try:
+ host = GenericHost.objects.get(pk=host_data['host_id'])
+ host_profile = host.profile
+ except Exception:
+ for host in hostlist:
+ if host.resource.name == host_data['host_name']:
+ host_profile = host.profile
+ break
excluded_images = Image.objects.exclude(owner=user).exclude(public=True)
excluded_images = excluded_images | Image.objects.exclude(host_type=host.profile)
lab = self.repo_get(self.repo.SWCONF_SELECTED_GRB).lab