From bca2a6cb56e09049e8cbb19bfc973c6dc2ddbebf Mon Sep 17 00:00:00 2001 From: Ilya Zonov Date: Thu, 9 Jun 2016 23:03:09 +0400 Subject: [PATCH] Fix rabbitmq parameter changed check (#2237) This commit fixes following issue: "Changed" flag is always true when var is used for value module param. --- .../modules/extras/messaging/rabbitmq_parameter.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/extras/messaging/rabbitmq_parameter.py b/lib/ansible/modules/extras/messaging/rabbitmq_parameter.py index 60b9811a9cb..9022910928b 100644 --- a/lib/ansible/modules/extras/messaging/rabbitmq_parameter.py +++ b/lib/ansible/modules/extras/messaging/rabbitmq_parameter.py @@ -96,12 +96,17 @@ class RabbitMqParameter(object): component, name, value = param_item.split('\t') if component == self.component and name == self.name: - self._value = value + self._value = json.loads(value) return True return False 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): self._exec(['clear_parameter', '-p', self.vhost, self.component, self.name]) @@ -126,8 +131,8 @@ def main(): component = module.params['component'] name = module.params['name'] value = module.params['value'] - if not isinstance(value, str): - value = json.dumps(value) + if isinstance(value, str): + value = json.loads(value) vhost = module.params['vhost'] state = module.params['state'] node = module.params['node']