Don't observe reality if name property is None

We use `physical_resource_name` for name property in some
resources when name not provided during create, so we
shouldn't add name in resource_data if it's None in
property (might just the cases that we using
`physical_resource_name`).
Closes-Bug: #1737696

Change-Id: I7b6bcfdd748fdb8664245c4b65ec7170c2ad4a94
This commit is contained in:
ricolin 2017-12-12 17:07:06 +08:00
parent d03514e3c8
commit 37bf1adfa7
5 changed files with 7 additions and 4 deletions

View File

@ -2207,6 +2207,13 @@ class Resource(status.ResourceStatus):
resource_result = {}
for key in self._update_allowed_properties:
if key in resource_data:
if key == 'name' and resource_properties.get(key) is None:
# We use `physical_resource_name` for name property in some
# resources when name not provided during create, so we
# shouldn't add name in resource_data if it's None in
# property (might just the cases that we using
# `physical_resource_name`).
continue
resource_result[key] = resource_data.get(key)
return resource_result

View File

@ -334,7 +334,6 @@ class NeutronNetTest(common.HeatTestCase):
reality = rsrc.get_live_state(rsrc.properties)
expected = {
'name': 'net1-net-wkkl2vwupdee',
'admin_state_up': True,
'qos_policy': "some",
'value_specs': {

View File

@ -819,7 +819,6 @@ class NeutronPortTest(common.HeatTestCase):
reality = port.get_live_state(port.properties)
expected = {
'name': 'flip-port-xjbal77qope3',
'allowed_address_pairs': [],
'admin_state_up': True,
'device_owner': '',

View File

@ -855,7 +855,6 @@ class NeutronRouterTest(common.HeatTestCase):
'network': '1ede231a-0b46-40fc-ab3b-8029446d0d1b',
'enable_snat': True
},
'name': 'er-router-naqzmqnzk4ej',
'admin_state_up': True,
'value_specs': {
'test_value_spec': 'spec_value'

View File

@ -749,7 +749,6 @@ class NeutronSubnetTest(common.HeatTestCase):
reality = rsrc.get_live_state(rsrc.properties)
expected = {
'name': 'subnet-subnet-la5usdgifhrd',
'enable_dhcp': True,
'dns_nameservers': [],
'allocation_pools': [{'start': '10.0.0.2', 'end': '10.0.0.126'}],