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
This commit is contained in:
Ryan Brady 2015-06-10 08:16:42 -04:00
parent ac95523881
commit 16e13d5689
2 changed files with 26 additions and 0 deletions

View File

@ -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()

View File

@ -23,6 +23,13 @@
</li></ul>
</div>
{% endif %}
</div>
<div>
<fieldset>
<div class="left">
{% include "horizon/common/_form_fields.html" %}
</div>
</fieldset>
<br /><br />
<div class="alert alert-warning">
<i class="fa fa-exclamation-triangle fa-3x pull-left text-warning"></i>