Do not validate property network of sahara cluster

enable to use network which is resource creating in template

Change-Id: I2f2014cd1c05bce5f248fe618eecbc4476914662
Closes-Bug: #1726334
This commit is contained in:
chestack 2017-10-23 18:06:04 +08:00
parent ec40f1301d
commit dcbaffe909
2 changed files with 4 additions and 10 deletions

View File

@ -126,6 +126,7 @@ class SaharaCluster(resource.Resource):
MANAGEMENT_NETWORK: properties.Schema( MANAGEMENT_NETWORK: properties.Schema(
properties.Schema.STRING, properties.Schema.STRING,
_('Name or UUID of network.'), _('Name or UUID of network.'),
required=True,
constraints=[ constraints=[
constraints.CustomConstraint('neutron.network') constraints.CustomConstraint('neutron.network')
], ],
@ -282,13 +283,6 @@ class SaharaCluster(resource.Resource):
if res: if res:
return res return res
# check if running on neutron and MANAGEMENT_NETWORK missing
if (self.is_using_neutron() and
not self.properties[self.MANAGEMENT_NETWORK]):
msg = _("%s must be provided"
) % self.MANAGEMENT_NETWORK
raise exception.StackValidationFailed(message=msg)
self.client_plugin().validate_hadoop_version( self.client_plugin().validate_hadoop_version(
self.properties[self.PLUGIN_NAME], self.properties[self.PLUGIN_NAME],
self.properties[self.HADOOP_VERSION] self.properties[self.HADOOP_VERSION]

View File

@ -176,11 +176,11 @@ class SaharaClusterTest(common.HeatTestCase):
self.t['resources']['super-cluster']['properties'].pop( self.t['resources']['super-cluster']['properties'].pop(
'neutron_management_network') 'neutron_management_network')
cluster = self._init_cluster(self.t) cluster = self._init_cluster(self.t)
self.patchobject(cluster, 'is_using_neutron', return_value=True)
ex = self.assertRaises(exception.StackValidationFailed, ex = self.assertRaises(exception.StackValidationFailed,
cluster.validate) cluster.validate)
self.assertEqual("neutron_management_network must be provided", error_msg = ('Property error: resources.super-cluster.properties: '
six.text_type(ex)) 'Property neutron_management_network not assigned')
self.assertEqual(error_msg, six.text_type(ex))
def test_deprecated_properties_correctly_translates(self): def test_deprecated_properties_correctly_translates(self):
tmpl = ''' tmpl = '''