From 16e13d56898fae84debc45aa3164c49386cedac1 Mon Sep 17 00:00:00 2001 From: Ryan Brady Date: Wed, 10 Jun 2015 08:16:42 -0400 Subject: [PATCH] Add Network Isolation This patch adds the ability for the operator to selectively enable network isolation. If enabled, the network isolation environment file is read from tripleo-heat-templates and appended to the plan.environment. Change-Id: I56874f185ff9c36009e28332ad901ac2ffb1fb40 --- tuskar_ui/infrastructure/overview/forms.py | 19 +++++++++++++++++++ .../overview/_deploy_confirmation.html | 7 +++++++ 2 files changed, 26 insertions(+) diff --git a/tuskar_ui/infrastructure/overview/forms.py b/tuskar_ui/infrastructure/overview/forms.py index 72449db63..b0eb5b342 100644 --- a/tuskar_ui/infrastructure/overview/forms.py +++ b/tuskar_ui/infrastructure/overview/forms.py @@ -283,6 +283,10 @@ class ScaleOut(EditPlan): class DeployOvercloud(horizon.forms.SelfHandlingForm): + network_isolation = horizon.forms.BooleanField( + label=_("Enable Network Isolation"), + required=False) + def handle(self, request, data): try: plan = api.tuskar.Plan.get_the_plan(request) @@ -292,6 +296,21 @@ class DeployOvercloud(horizon.forms.SelfHandlingForm): _("Unable to deploy overcloud.")) return False + # If network isolation selected, read environment file data + # and add to plan + env_temp = '/usr/share/openstack-tripleo-heat-templates/environments' + try: + if self.cleaned_data['network_isolation']: + with open(env_temp, 'r') as env_file: + env_contents = ''.join( + [line for line in + env_file.readlines() if '#' not in line] + ) + plan.environment += env_contents + except Exception as e: + LOG.exception(e) + pass + # Auto-generate missing passwords and certificates if plan.list_generated_parameters(): generated_params = plan.make_generated_parameters() diff --git a/tuskar_ui/infrastructure/templates/infrastructure/overview/_deploy_confirmation.html b/tuskar_ui/infrastructure/templates/infrastructure/overview/_deploy_confirmation.html index 2b7d1f6e8..b3daed670 100644 --- a/tuskar_ui/infrastructure/templates/infrastructure/overview/_deploy_confirmation.html +++ b/tuskar_ui/infrastructure/templates/infrastructure/overview/_deploy_confirmation.html @@ -23,6 +23,13 @@ {% endif %} + +
+
+
+ {% include "horizon/common/_form_fields.html" %} +
+