mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix python3 compatibility for znode module
kazoo client requires bytes and not string
This commit is contained in:
parent
0a2dda2060
commit
2d98a2de68
1 changed files with 3 additions and 2 deletions
5
lib/ansible/modules/clustering/znode.py
Normal file → Executable file
5
lib/ansible/modules/clustering/znode.py
Normal file → Executable file
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue