aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-01-03 10:49:29 -0500
committerParker Berberian <pberberian@iol.unh.edu>2019-01-03 10:49:29 -0500
commita0cbc41bc1691a7279a2a79401f00bf6b87796dd (patch)
tree6c6ad50d10e92ebcefa20c1df711a3c01b29231f
parentb729dd4e21e90fe6f83b31cabdcc9f74757c70bd (diff)
Requires a Jumphost per POD
It was assumed but never enforced that each pod configuration elects at least one host as the "jumphost". This commit makes that a requirement when creating a configuration. Change-Id: If55f1aa231b3cba8713f325f158796d85466b02a Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
-rw-r--r--src/workflow/sw_bundle_workflow.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/workflow/sw_bundle_workflow.py b/src/workflow/sw_bundle_workflow.py
index 26ade22..1695b65 100644
--- a/src/workflow/sw_bundle_workflow.py
+++ b/src/workflow/sw_bundle_workflow.py
@@ -125,6 +125,7 @@ class Define_Software(WorkflowStep):
HostFormset = formset_factory(HostSoftwareDefinitionForm, extra=0)
formset = HostFormset(request.POST)
hosts = self.get_host_list()
+ has_jumphost = False
if formset.is_valid():
models['host_configs'] = []
i = 0
@@ -147,6 +148,8 @@ class Define_Software(WorkflowStep):
except:
self.metastep.set_invalid("Image " + image.name + " is not compatible with host " + host.resource.name)
role = form.cleaned_data['role']
+ if "jumphost" in role.name.lower():
+ has_jumphost = True
bundle = models['bundle']
hostConfig = HostConfiguration(
host=host,
@@ -158,6 +161,10 @@ class Define_Software(WorkflowStep):
confirm_host = {"name": host.resource.name, "image": image.name, "role": role.name}
confirm_hosts.append(confirm_host)
+ if not has_jumphost:
+ self.metastep.set_invalid('Must have at least one "Jumphost" per POD')
+ return self.render(request)
+
self.repo_put(self.repo.CONFIG_MODELS, models)
if "configuration" not in confirm:
confirm['configuration'] = {}