Update relation data even if the new value is empty
This will enable removal of previously created resources. Originaly, the empty values were not propagated so the resource ended up in both fields "json_delete_resources" and "json_resources". Change-Id: I34693bb0e30bce96144a983e55e212e27029ba52
This commit is contained in:
parent
8125a7baec
commit
5954e84448
|
@ -84,7 +84,7 @@ class ResourceManagement():
|
|||
"""
|
||||
relation_data = {
|
||||
'json_{}'.format(k): json.dumps(v, sort_keys=True)
|
||||
for k, v in crm.items() if v
|
||||
for k, v in crm.items()
|
||||
}
|
||||
if self.data_changed('hacluster-manage_resources', relation_data):
|
||||
self.set_local(**relation_data)
|
||||
|
|
|
@ -181,8 +181,7 @@ class TestHAClusterRequires(unittest.TestCase):
|
|||
sort_keys=True,
|
||||
)
|
||||
for k, v in options.items():
|
||||
if v:
|
||||
options[k] = json.dumps(v, **json_encode_options)
|
||||
options[k] = json.dumps(v, **json_encode_options)
|
||||
|
||||
def test_manage_resources(self):
|
||||
res = common.CRM()
|
||||
|
@ -195,7 +194,14 @@ class TestHAClusterRequires(unittest.TestCase):
|
|||
'json_init_services': ["haproxy"],
|
||||
'json_resource_params': {
|
||||
"res_neutron_haproxy": ' op monitor interval="5s"'},
|
||||
'json_resources': {"res_neutron_haproxy": "lsb:haproxy"}}
|
||||
'json_resources': {"res_neutron_haproxy": "lsb:haproxy"},
|
||||
'json_delete_resources': [],
|
||||
'json_groups': {},
|
||||
'json_ms': {},
|
||||
'json_orders': {},
|
||||
'json_colocations': {},
|
||||
'json_locations': {},
|
||||
'json_systemd_services': []}
|
||||
self.jsonify(expected)
|
||||
self.rh_data_changed.return_value = True
|
||||
self.patch_kr('set_local')
|
||||
|
|
Loading…
Reference in New Issue