[Sahara] Adding ability to update missing fields

Field is_proxy_gateway and use_autoconfig of template objects
didn't change its value after node group template edit.
This patch allows to use initial value of these fields.

Closes-bug: #1480301

Change-Id: I5ff98b2bda87c6ff24bbf6baed3aff7cb2c9af84
This commit is contained in:
Andrey Pavlov 2015-07-31 14:58:17 +03:00 committed by Vitaly Gridnev
parent 5bcfe48a45
commit 659d66834d
7 changed files with 26 additions and 6 deletions

View File

@ -133,7 +133,8 @@ class DataProcessingClusterTemplateTests(test.TestCase):
description=ct.description, description=ct.description,
cluster_configs=ct.cluster_configs, cluster_configs=ct.cluster_configs,
node_groups=ct.node_groups, node_groups=ct.node_groups,
anti_affinity=ct.anti_affinity)\ anti_affinity=ct.anti_affinity,
use_autoconfig=False)\
.AndReturn(new_ct) .AndReturn(new_ct)
self.mox.ReplayAll() self.mox.ReplayAll()

View File

@ -91,7 +91,8 @@ class CopyClusterTemplate(create_flow.ConfigureClusterTemplate):
fields = step.action.fields fields = step.action.fields
fields["cluster_template_name"].initial = ( fields["cluster_template_name"].initial = (
self.template.name + "-copy") self.template.name + "-copy")
fields['use_autoconfig'].initial = (
self.template.use_autoconfig)
fields["description"].initial = self.template.description fields["description"].initial = self.template.description
except Exception: except Exception:
exceptions.handle(request, exceptions.handle(request,

View File

@ -91,6 +91,7 @@ class EditClusterTemplate(copy_flow.CopyClusterTemplate):
cluster_configs=configs_dict, cluster_configs=configs_dict,
node_groups=node_groups, node_groups=node_groups,
anti_affinity=context["anti_affinity_info"], anti_affinity=context["anti_affinity_info"],
use_autoconfig=context['general_use_autoconfig']
) )
return True return True
except exceptions.Conflict as e: except exceptions.Conflict as e:

View File

@ -274,7 +274,8 @@ class DataProcessingNodeGroupTests(test.TestCase):
security_groups=[], security_groups=[],
auto_security_group=True, auto_security_group=True,
availability_zone=None, availability_zone=None,
use_autoconfig=True).AndReturn(True) use_autoconfig=True,
is_proxy_gateway=False).AndReturn(True)
self.mox.ReplayAll() self.mox.ReplayAll()
@ -295,6 +296,7 @@ class DataProcessingNodeGroupTests(test.TestCase):
'volume_local_to_instance': False, 'volume_local_to_instance': False,
'volumes_availability_zone': None, 'volumes_availability_zone': None,
'floating_ip_pool': None, 'floating_ip_pool': None,
'is_proxy_gateway': False,
'security_autogroup': True, 'security_autogroup': True,
'processes': 'HDFS:namenode', 'processes': 'HDFS:namenode',
'use_autoconfig': True}) 'use_autoconfig': True})

View File

@ -81,6 +81,8 @@ class CopyNodegroupTemplate(create_flow.ConfigureNodegroupTemplate):
self.template.volumes_availability_zone self.template.volumes_availability_zone
g_fields['volume_type'].initial = volume_type g_fields['volume_type'].initial = volume_type
g_fields['volume_local_to_instance'].initial = volume_local_to_instance g_fields['volume_local_to_instance'].initial = volume_local_to_instance
g_fields["proxygateway"].initial = self.template.is_proxy_gateway
g_fields["use_autoconfig"].initial = self.template.use_autoconfig
if self.template.floating_ip_pool: if self.template.floating_ip_pool:
g_fields['floating_ip_pool'].initial = ( g_fields['floating_ip_pool'].initial = (

View File

@ -99,7 +99,8 @@ class EditNodegroupTemplate(copy_flow.CopyNodegroupTemplate):
security_groups=context["security_groups"], security_groups=context["security_groups"],
auto_security_group=context["security_autogroup"], auto_security_group=context["security_autogroup"],
availability_zone=context["general_availability_zone"], availability_zone=context["general_availability_zone"],
use_autoconfig=context['general_use_autoconfig']) use_autoconfig=context['general_use_autoconfig'],
is_proxy_gateway=context["general_proxygateway"])
return True return True
except api_base.APIException as e: except api_base.APIException as e:
self.error_description = str(e.message) self.error_description = str(e.message)

View File

@ -132,6 +132,8 @@ def data(TEST):
"volume_local_to_instance": False, "volume_local_to_instance": False,
"security_groups": [], "security_groups": [],
"volumes_availability_zone": None, "volumes_availability_zone": None,
"is_proxy_gateway": False,
"use_autoconfig": True,
} }
ngt1 = node_group_templates.NodeGroupTemplate( ngt1 = node_group_templates.NodeGroupTemplate(
@ -150,6 +152,7 @@ def data(TEST):
"id": "a2c3743f-31a2-4919-8d02-792138a87a98", "id": "a2c3743f-31a2-4919-8d02-792138a87a98",
"name": "sample-cluster-template", "name": "sample-cluster-template",
"neutron_management_network": None, "neutron_management_network": None,
"use_autoconfig": True,
"node_groups": [ "node_groups": [
{ {
"count": 1, "count": 1,
@ -174,6 +177,8 @@ def data(TEST):
"volume_type": None, "volume_type": None,
"volume_local_to_instance": False, "volume_local_to_instance": False,
"volumes_availability_zone": None, "volumes_availability_zone": None,
"use_autoconfig": True,
"is_proxy_gateway": False,
}, },
{ {
"count": 2, "count": 2,
@ -195,6 +200,8 @@ def data(TEST):
"volume_type": None, "volume_type": None,
"volume_local_to_instance": False, "volume_local_to_instance": False,
"volumes_availability_zone": None, "volumes_availability_zone": None,
"use_autoconfig": True,
"is_proxy_gateway": False
} }
], ],
"plugin_name": "vanilla", "plugin_name": "vanilla",
@ -221,6 +228,7 @@ def data(TEST):
"management_public_key": "fakekey", "management_public_key": "fakekey",
"name": "cercluster", "name": "cercluster",
"neutron_management_network": None, "neutron_management_network": None,
"use_autoconfig": True,
"node_groups": [ "node_groups": [
{ {
"count": 1, "count": 1,
@ -258,7 +266,9 @@ def data(TEST):
"volume_local_to_instance": False, "volume_local_to_instance": False,
"security_groups": [], "security_groups": [],
"volumes_availability_zone": None, "volumes_availability_zone": None,
"id": "ng1" "id": "ng1",
"use_autoconfig": True,
"is_proxy_gateway": False
}, },
{ {
"count": 2, "count": 2,
@ -303,7 +313,9 @@ def data(TEST):
"volume_local_to_instance": False, "volume_local_to_instance": False,
"security_groups": ["b7857890-09bf-4ee0-a0d5-322d7a6978bf"], "security_groups": ["b7857890-09bf-4ee0-a0d5-322d7a6978bf"],
"volumes_availability_zone": None, "volumes_availability_zone": None,
"id": "ng2" "id": "ng2",
"use_autoconfig": True,
"is_proxy_gateway": False
} }
], ],
"plugin_name": "vanilla", "plugin_name": "vanilla",