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
changes/57/527357/2
ricolin 5 years ago
parent d03514e3c8
commit 37bf1adfa7
  1. 7
      heat/engine/resource.py
  2. 1
      heat/tests/openstack/neutron/test_neutron_net.py
  3. 1
      heat/tests/openstack/neutron/test_neutron_port.py
  4. 1
      heat/tests/openstack/neutron/test_neutron_router.py
  5. 1
      heat/tests/openstack/neutron/test_neutron_subnet.py

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

@ -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': {

@ -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': '',

@ -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'

@ -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'}],

Loading…
Cancel
Save