summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/clustering/znode.py
diff options
context:
space:
mode:
authorGrigory Starinkin <starinkin@gmail.com>2018-03-05 10:08:24 +0000
committerToshio Kuratomi <a.badger@gmail.com>2018-03-05 13:02:40 -0800
commit98b5ffec04f47e280cc2e764fa67458ca8a0534d (patch)
tree641730dd1fff67e213b3e6c024cd79305bae7dc8 /lib/ansible/modules/clustering/znode.py
parent5911ee813a791afe269fb5366f079a8740761226 (diff)
downloadansible-98b5ffec04f47e280cc2e764fa67458ca8a0534d.tar.gz
fix python3 compatibility for znode module
kazoo client requires bytes and not string (cherry picked from commit 2d98a2de6802122fc1b495ccb91481db2dac7f24)
Diffstat (limited to 'lib/ansible/modules/clustering/znode.py')
-rwxr-xr-x[-rw-r--r--]lib/ansible/modules/clustering/znode.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ansible/modules/clustering/znode.py b/lib/ansible/modules/clustering/znode.py
index fad04ae202..71cd500758 100644..100755
--- a/lib/ansible/modules/clustering/znode.py
+++ b/lib/ansible/modules/clustering/znode.py
@@ -111,6 +111,7 @@ except ImportError:
KAZOO_INSTALLED = False
from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils._text import to_bytes
def main():
@@ -232,13 +233,13 @@ class KazooCommandProxy():
if self.exists(path):
(current_value, zstat) = self.zk.get(path)
if value != current_value:
- self.zk.set(path, value)
+ self.zk.set(path, to_bytes(value))
return True, {'changed': True, 'msg': 'Updated the znode value.', 'znode': path,
'value': value}
else:
return True, {'changed': False, 'msg': 'No changes were necessary.', 'znode': path, 'value': value}
else:
- self.zk.create(path, value, makepath=True)
+ self.zk.create(path, to_bytes(value), makepath=True)
return True, {'changed': True, 'msg': 'Created a new znode.', 'znode': path, 'value': value}
def _wait(self, path, timeout, interval=5):