Skip to content

Commit

Permalink
migrate apply-config-from-env.py from python2 to python3 (apache#3614)
Browse files Browse the repository at this point in the history
Fix apache#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
  • Loading branch information
xiang092689 authored and lhotari committed Feb 9, 2024
1 parent 3370ae6 commit 9f7293b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docker/scripts/apply-config-from-env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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_'
Expand Down Expand Up @@ -75,13 +75,13 @@ def mylistdir(dir):
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)

Expand Down

0 comments on commit 9f7293b

Please sign in to comment.