aboutsummaryrefslogtreecommitdiff
path: root/docker/base
diff options
context:
space:
mode:
authorSteven Dake <stdake@cisco.com>2016-05-01 14:00:54 -0400
committerSteven Dake <stdake@cisco.com>2016-05-02 06:12:50 -0700
commit025d57f82005a4ea92950f9b4d717c88f647d15f (patch)
treee366312a926efda5fa70bcd9c1e4894327e71e6d /docker/base
parent420f8740ea4a9c6e534fd57e66ea77ec11cdad5a (diff)
downloadkolla-025d57f82005a4ea92950f9b4d717c88f647d15f.tar.gz
kolla-025d57f82005a4ea92950f9b4d717c88f647d15f.zip
Remove dependencies on kazoo and friends
Since kolla-mesos has been retired, there is no need in the code base to keep the zookeeper implementation. As a result, just remove it. If we were to keep it we need virtualenvs for that part of the code base which installs the python dependencies related to it for from-binary installs. This just simplifies the implementation tremendously and culls dead code. Change-Id: Ieda226e652d67f5b5667112f4f2556f3171366d3 Closes-Bug: #1577194
Diffstat (limited to 'docker/base')
-rw-r--r--docker/base/Dockerfile.j29
-rw-r--r--docker/base/set_configs.py71
2 files changed, 1 insertions, 79 deletions
diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2
index ba5759bf6..22181ff9c 100644
--- a/docker/base/Dockerfile.j2
+++ b/docker/base/Dockerfile.j2
@@ -155,9 +155,6 @@ RUN yum -y install \
sudo \
which \
python \
- python-jinja2 \
- python-kazoo \
- python-six \
lvm2 \
scsi-target-utils \
iscsi-initiator-utils \
@@ -171,9 +168,6 @@ RUN yum -y install \
# Update packages
RUN yum -y install \
curl \
- python-jinja2 \
- python-kazoo \
- python-six \
sudo \
tar \
which \
@@ -207,9 +201,6 @@ RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 199369E540
&& apt-get install -y --no-install-recommends \
ca-certificates \
python \
- python-jinja2 \
- python-kazoo \
- python-six \
curl \
open-iscsi \
tgt \
diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py
index dc0a7e4a5..fd22a3155 100644
--- a/docker/base/set_configs.py
+++ b/docker/base/set_configs.py
@@ -13,7 +13,6 @@
# limitations under the License.
import argparse
-import contextlib
import json
import logging
import os
@@ -21,10 +20,6 @@ import pwd
import shutil
import sys
-from kazoo import client as kz_client
-from kazoo import exceptions as kz_exceptions
-from six.moves.urllib import parse
-
# TODO(rhallisey): add docstring.
logging.basicConfig()
@@ -50,11 +45,7 @@ def validate_config(config):
def validate_source(data):
source = data.get('source')
- if is_zk_transport(source):
- with zk_connection(source) as zk:
- exists = zk_path_exists(zk, source)
- else:
- exists = os.path.exists(source)
+ exists = os.path.exists(source)
if not exists:
if data.get('optional'):
@@ -67,61 +58,6 @@ def validate_source(data):
return True
-def is_zk_transport(path):
- return path.startswith('zk://') or \
- os.environ.get("KOLLA_ZK_HOSTS") is not None
-
-
-@contextlib.contextmanager
-def zk_connection(url):
- # support an environment and url
- # if url, it should be like this:
- # zk://<address>:<port>/<path>
-
- zk_hosts = os.environ.get("KOLLA_ZK_HOSTS")
- if zk_hosts is None:
- components = parse.urlparse(url)
- zk_hosts = components.netloc
- zk = kz_client.KazooClient(hosts=zk_hosts)
- zk.start()
- try:
- yield zk
- finally:
- zk.stop()
-
-
-def zk_path_exists(zk, path):
- try:
- components = parse.urlparse(path)
- zk.get(components.path)
- return True
- except kz_exceptions.NoNodeError:
- return False
-
-
-def zk_copy_tree(zk, src, dest):
- """Recursively copy contents of url_source into dest."""
- data, stat = zk.get(src)
-
- if data:
- dest_path = os.path.dirname(dest)
- if not os.path.exists(dest_path):
- LOG.info("Creating dest parent directory: %s", dest_path)
- os.makedirs(dest_path)
-
- LOG.info("Copying %s to %s", src, dest)
- with open(dest, 'w') as df:
- df.write(data.decode("utf-8"))
-
- try:
- children = zk.get_children(src)
- except kz_exceptions.NoNodeError:
- return
- for child in children:
- zk_copy_tree(zk, os.path.join(src, child),
- os.path.join(dest, child))
-
-
def copy_files(data):
dest = data.get('dest')
source = data.get('source')
@@ -133,11 +69,6 @@ def copy_files(data):
else:
os.remove(dest)
- if is_zk_transport(source):
- with zk_connection(source) as zk:
- components = parse.urlparse(source)
- return zk_copy_tree(zk, components.path, dest)
-
if os.path.isdir(source):
source_path = source
dest_path = dest