Fix default parse_live_resource_data
Add additional check, is property in response body or it will return incorrect data for update instead. Change-Id: I2b70da243a4bf9d0beb01faf3d4057d2bfe93eb2 Closes-bug: #1662099
This commit is contained in:
parent
45ae709e75
commit
9b1804eeb3
@ -1942,7 +1942,8 @@ class Resource(object):
|
||||
"""
|
||||
resource_result = {}
|
||||
for key in self._update_allowed_properties:
|
||||
resource_result[key] = resource_data.get(key)
|
||||
if key in resource_data:
|
||||
resource_result[key] = resource_data.get(key)
|
||||
|
||||
return resource_result
|
||||
|
||||
|
@ -4135,12 +4135,12 @@ class TestLiveStateUpdate(common.HeatTestCase):
|
||||
def test_parse_live_resource_data(self):
|
||||
res = self._prepare_resource_live_state()
|
||||
|
||||
res.update_allowed_props = mock.Mock(return_value=['Foo'])
|
||||
res.update_allowed_props = mock.Mock(return_value=['Foo', 'Bar'])
|
||||
resource_data = {
|
||||
'Foo': 'brave new data',
|
||||
'Something not so good': 'for all of us'
|
||||
}
|
||||
res._update_allowed_properties = ['Foo']
|
||||
res._update_allowed_properties = ['Foo', 'Bar']
|
||||
result = res.parse_live_resource_data(res.properties, resource_data)
|
||||
self.assertEqual({'Foo': 'brave new data'}, result)
|
||||
self._clean_tests_after_resource_live_state(res)
|
||||
|
Loading…
Reference in New Issue
Block a user