To merge the occ data for OS::Heat::DeployedServer

To merge the occ data always when update for
resource OS::Heat::DeployedServer.

Change-Id: I3d2bda2f63492a5961b4e524e06b138eb0dce59f
Closes-Bug: #1693662
(cherry picked from commit 1da13181c2)
This commit is contained in:
huangtianhua 2017-06-01 15:39:40 +08:00
parent 297c126aff
commit 5fd659c8bd
2 changed files with 18 additions and 4 deletions

View File

@ -106,6 +106,9 @@ class DeployedServer(server_base.BaseServer):
return self.resource_id
def user_data_software_config(self):
return True
def _delete(self):
self._delete_queue()
self._delete_user()

View File

@ -238,10 +238,9 @@ class DeployedServersTest(common.HeatTestCase):
self.assertFalse(stack.access_allowed('4567', 'wserver'))
return stack, server
def test_server_create_software_config_poll_heat(self):
def test_server_software_config_poll_heat(self):
stack, server = self._server_create_software_config_poll_heat()
self.assertEqual({
md = {
'os-collect-config': {
'heat': {
'auth_url': 'http://server.test:5000/v2.0',
@ -254,7 +253,19 @@ class DeployedServersTest(common.HeatTestCase):
'collectors': ['heat', 'local']
},
'deployments': []
}, server.metadata_get())
}
self.assertEqual(md, server.metadata_get())
# update resource.metadata
md1 = {'os-collect-config': {'polling_interval': 10}}
server.stack.t.t['resources']['server']['metadata'] = md1
resource_defns = server.stack.t.resource_definitions(server.stack)
scheduler.TaskRunner(server.update, resource_defns['server'])()
occ = md['os-collect-config']
occ.update(md1['os-collect-config'])
# os-collect-config merged
self.assertEqual(md, server.metadata_get())
def test_server_create_software_config_poll_heat_metadata(self):
md = {'os-collect-config': {'polling_interval': 10}}