This is an automated email from the ASF dual-hosted git repository.
shoothzj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 43bdfb3531 migrate apply-config-from-env.py from python2 to python3
(#3614)
43bdfb3531 is described below
commit 43bdfb35317d9a69840d17df94c5c801a4cbba62
Author: xiang092689 <[email protected]>
AuthorDate: Mon Nov 7 13:48:58 2022 +0800
migrate apply-config-from-env.py from python2 to python3 (#3614)
Fix #3549
Descriptions of the changes in this PR:
migrate apply-config-from-env.py from python2 to python3
fix docker/Dockerfile
### Motivation
Issue 3549: migrate apply-config-from-env.py from python2 to python3
### Changes
add newline character, and reformat for docker/Dockerfile
change print to print()
Master Issue: 3549
---
docker/Dockerfile | 6 +++---
docker/scripts/apply-config-from-env.py | 10 +++++-----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 586a2c4695..fafb7dea0d 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -43,9 +43,9 @@ RUN set -x \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& apt-get install -y --no-install-recommends gpg gpg-agent wget sudo \
&& apt-get -y --purge autoremove \
- && apt-get autoclean \
- && apt-get clean \
- && rm -rf /var/lib/apt/lists/*
+ && apt-get autoclean \
+ && apt-get clean \
+ && rm -rf /var/lib/apt/lists/* \
&& mkdir -pv /opt \
&& cd /opt \
&& wget -q "${DISTRO_URL}" \
diff --git a/docker/scripts/apply-config-from-env.py
b/docker/scripts/apply-config-from-env.py
index 3fccab9816..105a2bacaf 100755
--- a/docker/scripts/apply-config-from-env.py
+++ b/docker/scripts/apply-config-from-env.py
@@ -29,7 +29,7 @@
import os, sys
if len(sys.argv) != 2:
- print 'Usage: %s ' + 'config_dir' % (sys.argv[0])
+ print('Usage: %s ' + 'config_dir' % (sys.argv[0]))
sys.exit(1)
def mylistdir(dir):
@@ -38,8 +38,8 @@ def mylistdir(dir):
# Always apply env config to all the files under conf
conf_dir = sys.argv[1]
conf_files = mylistdir(conf_dir)
-print 'conf files: '
-print conf_files
+print('conf files: ')
+print(conf_files)
bk_env_prefix = 'BK_'
zk_env_prefix = 'ZK_'
@@ -75,13 +75,13 @@ for conf_filename in conf_files:
if k.startswith(bk_env_prefix):
search_key = k[len(bk_env_prefix):]
if search_key in keys:
- print '[%s] Applying config %s = %s' % (conf_filename,
search_key, v)
+ print('[%s] Applying config %s = %s' % (conf_filename,
search_key, v))
idx = keys[search_key]
lines[idx] = '%s=%s\n' % (search_key, v)
if k.startswith(zk_env_prefix):
search_key = k[len(zk_env_prefix):]
if search_key in keys:
- print '[%s] Applying config %s = %s' % (conf_filename,
search_key, v)
+ print('[%s] Applying config %s = %s' % (conf_filename,
search_key, v))
idx = keys[search_key]
lines[idx] = '%s=%s\n' % (search_key, v)