You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/01/28 02:38:31 UTC

[pulsar] branch master updated: Add set python version script (#3427)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 0446075  Add set python version script (#3427)
0446075 is described below

commit 0446075447013c26b60654ada75c65b1c4e33278
Author: Ali Ahmed <al...@gmail.com>
AuthorDate: Sun Jan 27 18:38:27 2019 -0800

    Add set python version script (#3427)
---
 docker/pulsar/Dockerfile                                |  1 +
 .../pulsar/scripts/set_python_version.sh                | 17 ++++++++++-------
 tests/docker-images/latest-version-image/Dockerfile     |  1 +
 .../latest-version-image/scripts/run-bookie.sh          |  2 ++
 .../latest-version-image/scripts/run-broker.sh          |  2 ++
 .../scripts/run-functions-worker.sh                     |  2 ++
 .../latest-version-image/scripts/run-global-zk.sh       |  2 ++
 .../latest-version-image/scripts/run-local-zk.sh        |  2 ++
 .../latest-version-image/scripts/run-presto-worker.sh   |  2 ++
 .../latest-version-image/scripts/run-proxy.sh           |  3 ++-
 .../scripts/{run-local-zk.sh => run-standalone.sh}      | 10 ++--------
 11 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/docker/pulsar/Dockerfile b/docker/pulsar/Dockerfile
index edbe622..d466ec5 100644
--- a/docker/pulsar/Dockerfile
+++ b/docker/pulsar/Dockerfile
@@ -34,6 +34,7 @@ COPY scripts/gen-yml-from-env.py /pulsar/bin
 COPY scripts/generate-zookeeper-config.sh /pulsar/bin
 COPY scripts/pulsar-zookeeper-ruok.sh /pulsar/bin
 COPY scripts/watch-znode.py /pulsar/bin
+COPY scripts/set_python_version.sh /pulsar/bin
 COPY scripts/install-pulsar-client-27.sh /pulsar/bin
 COPY scripts/install-pulsar-client-37.sh /pulsar/bin
 
diff --git a/tests/docker-images/latest-version-image/scripts/run-local-zk.sh b/docker/pulsar/scripts/set_python_version.sh
similarity index 69%
copy from tests/docker-images/latest-version-image/scripts/run-local-zk.sh
copy to docker/pulsar/scripts/set_python_version.sh
index b27212b..0ea2aa3 100755
--- a/tests/docker-images/latest-version-image/scripts/run-local-zk.sh
+++ b/docker/pulsar/scripts/set_python_version.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/bash
 #
 # Licensed to the Apache Software Foundation (ASF) under one
 # or more contributor license agreements.  See the NOTICE file
@@ -18,12 +18,15 @@
 # under the License.
 #
 
-bin/apply-config-from-env.py conf/zookeeper.conf && \
-    bin/apply-config-from-env.py conf/pulsar_env.sh && \
-    bin/generate-zookeeper-config.sh conf/zookeeper.conf
+set -x
 
-if [ -z "$NO_AUTOSTART" ]; then
-    sed -i 's/autostart=.*/autostart=true/' /etc/supervisord/conf.d/local-zk.conf
+# CHECK PYTHON 3 FLAG and execute update alternatives
+
+FLAG=$(echo $SET_PYTHON_3_DEFAULT | tr '[:upper:]' '[:lower:]')
+
+if [ "$FLAG" = "true" ] ; then
+  update-alternatives --install /usr/bin/python python /usr/bin/python3 10
 fi
 
-exec /usr/bin/supervisord -c /etc/supervisord.conf
+echo "Python Version ..."
+python -V
\ No newline at end of file
diff --git a/tests/docker-images/latest-version-image/Dockerfile b/tests/docker-images/latest-version-image/Dockerfile
index cb3caec..4ded790 100644
--- a/tests/docker-images/latest-version-image/Dockerfile
+++ b/tests/docker-images/latest-version-image/Dockerfile
@@ -36,6 +36,7 @@ COPY ssl/ca.cert.pem ssl/broker.key-pk8.pem ssl/broker.cert.pem \
 
 COPY scripts/init-cluster.sh scripts/run-global-zk.sh scripts/run-local-zk.sh \
      scripts/run-bookie.sh scripts/run-broker.sh scripts/run-functions-worker.sh scripts/run-proxy.sh scripts/run-presto-worker.sh \
+     scripts/run-standalone.sh \
      /pulsar/bin/
 
 # copy python test examples
diff --git a/tests/docker-images/latest-version-image/scripts/run-bookie.sh b/tests/docker-images/latest-version-image/scripts/run-bookie.sh
index 6e57a12..ee6baa4 100755
--- a/tests/docker-images/latest-version-image/scripts/run-bookie.sh
+++ b/tests/docker-images/latest-version-image/scripts/run-bookie.sh
@@ -18,6 +18,8 @@
 # under the License.
 #
 
+bin/set_python_version.sh
+
 bin/apply-config-from-env.py conf/bookkeeper.conf && \
     bin/apply-config-from-env.py conf/pulsar_env.sh
 
diff --git a/tests/docker-images/latest-version-image/scripts/run-broker.sh b/tests/docker-images/latest-version-image/scripts/run-broker.sh
index 6ed5d60..cc901bb 100755
--- a/tests/docker-images/latest-version-image/scripts/run-broker.sh
+++ b/tests/docker-images/latest-version-image/scripts/run-broker.sh
@@ -18,6 +18,8 @@
 # under the License.
 #
 
+bin/set_python_version.sh
+
 bin/apply-config-from-env.py conf/broker.conf && \
     bin/apply-config-from-env.py conf/pulsar_env.sh
 
diff --git a/tests/docker-images/latest-version-image/scripts/run-functions-worker.sh b/tests/docker-images/latest-version-image/scripts/run-functions-worker.sh
index 3fadf96..a118f1a 100755
--- a/tests/docker-images/latest-version-image/scripts/run-functions-worker.sh
+++ b/tests/docker-images/latest-version-image/scripts/run-functions-worker.sh
@@ -18,6 +18,8 @@
 # under the License.
 #
 
+bin/set_python_version.sh
+
 bin/apply-config-from-env.py conf/client.conf && \
     bin/gen-yml-from-env.py conf/functions_worker.yml && \
     bin/apply-config-from-env.py conf/pulsar_env.sh
diff --git a/tests/docker-images/latest-version-image/scripts/run-global-zk.sh b/tests/docker-images/latest-version-image/scripts/run-global-zk.sh
index 783ef2d..f5a33b9 100755
--- a/tests/docker-images/latest-version-image/scripts/run-global-zk.sh
+++ b/tests/docker-images/latest-version-image/scripts/run-global-zk.sh
@@ -18,6 +18,8 @@
 # under the License.
 #
 
+bin/set_python_version.sh
+
 bin/apply-config-from-env.py conf/zookeeper.conf && \
     bin/apply-config-from-env.py conf/pulsar_env.sh && \
     bin/generate-zookeeper-config.sh conf/global_zookeeper.conf
diff --git a/tests/docker-images/latest-version-image/scripts/run-local-zk.sh b/tests/docker-images/latest-version-image/scripts/run-local-zk.sh
index b27212b..da2b45c 100755
--- a/tests/docker-images/latest-version-image/scripts/run-local-zk.sh
+++ b/tests/docker-images/latest-version-image/scripts/run-local-zk.sh
@@ -18,6 +18,8 @@
 # under the License.
 #
 
+bin/set_python_version.sh
+
 bin/apply-config-from-env.py conf/zookeeper.conf && \
     bin/apply-config-from-env.py conf/pulsar_env.sh && \
     bin/generate-zookeeper-config.sh conf/zookeeper.conf
diff --git a/tests/docker-images/latest-version-image/scripts/run-presto-worker.sh b/tests/docker-images/latest-version-image/scripts/run-presto-worker.sh
index a78f955..1de9c1a 100755
--- a/tests/docker-images/latest-version-image/scripts/run-presto-worker.sh
+++ b/tests/docker-images/latest-version-image/scripts/run-presto-worker.sh
@@ -18,6 +18,8 @@
 # under the License.
 #
 
+bin/set_python_version.sh
+
 bin/apply-config-from-env.py conf/presto/catalog/pulsar.properties && \
     bin/apply-config-from-env.py conf/pulsar_env.sh
 
diff --git a/tests/docker-images/latest-version-image/scripts/run-proxy.sh b/tests/docker-images/latest-version-image/scripts/run-proxy.sh
index 8c0c5c3..f501921 100755
--- a/tests/docker-images/latest-version-image/scripts/run-proxy.sh
+++ b/tests/docker-images/latest-version-image/scripts/run-proxy.sh
@@ -18,6 +18,8 @@
 # under the License.
 #
 
+bin/set_python_version.sh
+
 bin/apply-config-from-env.py conf/proxy.conf && \
     bin/apply-config-from-env.py conf/pulsar_env.sh
 
@@ -27,4 +29,3 @@ fi
 
 bin/watch-znode.py -z $zookeeperServers -p /initialized-$clusterName -w
 exec /usr/bin/supervisord -c /etc/supervisord.conf
-
diff --git a/tests/docker-images/latest-version-image/scripts/run-local-zk.sh b/tests/docker-images/latest-version-image/scripts/run-standalone.sh
similarity index 70%
copy from tests/docker-images/latest-version-image/scripts/run-local-zk.sh
copy to tests/docker-images/latest-version-image/scripts/run-standalone.sh
index b27212b..69c1faf 100755
--- a/tests/docker-images/latest-version-image/scripts/run-local-zk.sh
+++ b/tests/docker-images/latest-version-image/scripts/run-standalone.sh
@@ -18,12 +18,6 @@
 # under the License.
 #
 
-bin/apply-config-from-env.py conf/zookeeper.conf && \
-    bin/apply-config-from-env.py conf/pulsar_env.sh && \
-    bin/generate-zookeeper-config.sh conf/zookeeper.conf
+bin/set_python_version.sh
 
-if [ -z "$NO_AUTOSTART" ]; then
-    sed -i 's/autostart=.*/autostart=true/' /etc/supervisord/conf.d/local-zk.conf
-fi
-
-exec /usr/bin/supervisord -c /etc/supervisord.conf
+bin/pulsar standalone
\ No newline at end of file