diff options
Diffstat (limited to 'src/workflow')
-rw-r--r-- | src/workflow/resource_bundle_workflow.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/workflow/resource_bundle_workflow.py b/src/workflow/resource_bundle_workflow.py index 391d33e..006f481 100644 --- a/src/workflow/resource_bundle_workflow.py +++ b/src/workflow/resource_bundle_workflow.py @@ -10,6 +10,7 @@ from django.conf import settings from django.forms import formset_factory +from django.core.exceptions import ValidationError from typing import List @@ -251,20 +252,21 @@ class Define_Software(WorkflowStep): # TODO: fix headnode in form, currently doesn't return a selected one # models['headnode_index'] = post_data.get("headnode", 1) formset = self.create_hostformset(hosts, data=post_data) - has_headnode = False if formset.is_valid(): for i, form in enumerate(formset): host = hosts[i] image = form.cleaned_data['image'] hostname = form.cleaned_data['host_name'] headnode = form.cleaned_data['headnode'] - if headnode: - has_headnode = True host.is_head_node = headnode host.name = hostname host.image = image host.save() + if not has_headnode: + self.set_invalid("No headnode. Please set a headnode.") + return + self.set_valid("Completed") else: self.set_invalid("Please complete all fields") |