1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix rabbitmq parameter changed check (#2237)

This commit fixes following issue: "Changed" flag is always true when
var is used for value module param.
This commit is contained in:
Ilya Zonov 2016-06-09 23:03:09 +04:00 committed by Matt Clay
parent 6557fc5c64
commit bca2a6cb56

View file

@ -96,12 +96,17 @@ class RabbitMqParameter(object):
component, name, value = param_item.split('\t') component, name, value = param_item.split('\t')
if component == self.component and name == self.name: if component == self.component and name == self.name:
self._value = value self._value = json.loads(value)
return True return True
return False return False
def set(self): def set(self):
self._exec(['set_parameter', '-p', self.vhost, self.component, self.name, self.value]) self._exec(['set_parameter',
'-p',
self.vhost,
self.component,
self.name,
json.dumps(self.value)])
def delete(self): def delete(self):
self._exec(['clear_parameter', '-p', self.vhost, self.component, self.name]) self._exec(['clear_parameter', '-p', self.vhost, self.component, self.name])
@ -126,8 +131,8 @@ def main():
component = module.params['component'] component = module.params['component']
name = module.params['name'] name = module.params['name']
value = module.params['value'] value = module.params['value']
if not isinstance(value, str): if isinstance(value, str):
value = json.dumps(value) value = json.loads(value)
vhost = module.params['vhost'] vhost = module.params['vhost']
state = module.params['state'] state = module.params['state']
node = module.params['node'] node = module.params['node']