From 77593f4c259239b33df408a34c1f3796aab1bac4 Mon Sep 17 00:00:00 2001
From: Michal Rostecki <mrostecki@mirantis.com>
Date: Mon, 14 Dec 2015 09:34:56 +0100
Subject: [PATCH] Add ZooKeeper module to kolla-ansible

ZooKeeper module already existed, but was not added to the
container.

Closes-Bug: #1525820
TrivialFix

Change-Id: I4de6aea4d4b209c94ed33205b0ec3c339e9ab692
---
 docker/kolla-ansible/Dockerfile.j2      | 2 +-
 docker/kolla-ansible/kolla_zookeeper.py | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/docker/kolla-ansible/Dockerfile.j2 b/docker/kolla-ansible/Dockerfile.j2
index 0e6770ff4..1d0228d54 100644
--- a/docker/kolla-ansible/Dockerfile.j2
+++ b/docker/kolla-ansible/Dockerfile.j2
@@ -49,7 +49,7 @@ RUN mkdir -p /etc/ansible /usr/share/ansible /home/ansible \
     && echo 'localhost ansible_connection=local' > /etc/ansible/hosts \
     && useradd --user-group ansible --groups kolla
 
-COPY find_disks.py kolla_keystone_service.py kolla_keystone_user.py kolla_sanity.py /usr/share/ansible/
+COPY find_disks.py kolla_keystone_service.py kolla_keystone_user.py kolla_sanity.py kolla_zookeeper.py /usr/share/ansible/
 COPY ansible.cfg /home/ansible/.ansible.cfg
 
 {{ include_footer }}
diff --git a/docker/kolla-ansible/kolla_zookeeper.py b/docker/kolla-ansible/kolla_zookeeper.py
index da692605a..536200076 100644
--- a/docker/kolla-ansible/kolla_zookeeper.py
+++ b/docker/kolla-ansible/kolla_zookeeper.py
@@ -16,7 +16,8 @@
 
 import contextlib
 
-import kazoo
+import kazoo.client
+import kazoo.exceptions
 
 
 @contextlib.contextmanager
@@ -49,9 +50,9 @@ def main():
                 zk.get(path)
             except kazoo.exceptions.NoNodeError:
                 if value is None:
-                    zk.create(path)
+                    zk.create(path, makepath=True)
                 else:
-                    zk.create(path, value=value.encode())
+                    zk.create(path, value=value.encode(), makepath=True)
                 changed = True
 
         module.exit_json(changed=changed)
-- 
GitLab