Fix property comparison in neutron resources
We were trying to validate deprecated neutron properties with properties.data, which work when you have a reference, but not a parameter. Instead, compare it None which is what's the value when it's not set at all. We can't backport the original patch because it uses the new translation mechanism for deprecating properties. Change-Id: Ifa96a1cf94ced833afaf4b7ca306a953987548b6 Closes-Bug: #1518676
This commit is contained in:
parent
4aa687ed79
commit
0327150145
|
@ -17,7 +17,6 @@ import warnings
|
|||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
from heat.engine import properties as properties_module
|
||||
from heat.engine import resource
|
||||
|
||||
|
||||
|
@ -52,17 +51,13 @@ class NeutronResource(resource.Resource):
|
|||
|
||||
@staticmethod
|
||||
def _validate_depr_property_required(properties, prop_key, depr_prop_key):
|
||||
if isinstance(properties, properties_module.Properties):
|
||||
prop_value = properties.data.get(prop_key)
|
||||
depr_prop_value = properties.data.get(depr_prop_key)
|
||||
else:
|
||||
prop_value = properties.get(prop_key)
|
||||
depr_prop_value = properties.get(depr_prop_key)
|
||||
prop_value = properties.get(prop_key)
|
||||
depr_prop_value = properties.get(depr_prop_key)
|
||||
|
||||
if prop_value and depr_prop_value:
|
||||
raise exception.ResourcePropertyConflict(prop_key,
|
||||
depr_prop_key)
|
||||
if not prop_value and not depr_prop_value:
|
||||
if prop_value is None and depr_prop_value is None:
|
||||
raise exception.PropertyUnspecifiedError(prop_key,
|
||||
depr_prop_key)
|
||||
|
||||
|
|
Loading…
Reference in New Issue