Fix cluster config updating operation

Cluster config property can not be updated correctly.

Change-Id: I28ac448b488bf14c0734b917642095a8ae51ae11
Closes-Bug: #1704025
This commit is contained in:
liyi 2017-07-13 09:08:33 +08:00
parent 90575634d9
commit 8a23231a45
2 changed files with 5 additions and 0 deletions

View File

@ -253,12 +253,15 @@ class ClusterAction(base.Action):
self.entity.set_status(self.context, consts.CS_ERROR, reason) self.entity.set_status(self.context, consts.CS_ERROR, reason)
return self.RES_ERROR, reason return self.RES_ERROR, reason
config = self.inputs.get('config')
name = self.inputs.get('name') name = self.inputs.get('name')
metadata = self.inputs.get('metadata') metadata = self.inputs.get('metadata')
timeout = self.inputs.get('timeout') timeout = self.inputs.get('timeout')
profile_id = self.inputs.get('new_profile_id') profile_id = self.inputs.get('new_profile_id')
profile_only = self.inputs.get('profile_only') profile_only = self.inputs.get('profile_only')
if config is not None:
self.entity.config = config
if name is not None: if name is not None:
self.entity.name = name self.entity.name = name
if metadata is not None: if metadata is not None:

View File

@ -188,6 +188,7 @@ class TestCluster(base.SenlinTestCase):
cluster.timeout = 120 cluster.timeout = 120
cluster.data = {'FOO': 'BAR'} cluster.data = {'FOO': 'BAR'}
cluster.metadata = {'KEY': 'VALUE'} cluster.metadata = {'KEY': 'VALUE'}
cluster.config = {'KEY': 'VALUE'}
new_id = cluster.store(self.context) new_id = cluster.store(self.context)
self.assertEqual(cluster_id, new_id) self.assertEqual(cluster_id, new_id)
@ -206,6 +207,7 @@ class TestCluster(base.SenlinTestCase):
self.assertEqual(120, result.timeout) self.assertEqual(120, result.timeout)
self.assertEqual({'FOO': 'BAR'}, result.data) self.assertEqual({'FOO': 'BAR'}, result.data)
self.assertEqual({'KEY': 'VALUE'}, result.metadata) self.assertEqual({'KEY': 'VALUE'}, result.metadata)
self.assertEqual({'KEY': 'VALUE'}, result.config)
@mock.patch.object(cm.Cluster, '_from_object') @mock.patch.object(cm.Cluster, '_from_object')
def test_load_via_db_object(self, mock_init): def test_load_via_db_object(self, mock_init):