From ba25df0b1cf2261e0247c025b3c2bc099f408618 Mon Sep 17 00:00:00 2001 From: Zhaofeng Yang Date: Mon, 1 Nov 2021 12:32:38 +0800 Subject: [PATCH 1/2] subprocess should be run when this if statement is true --- docker/entrypoint.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/entrypoint.py b/docker/entrypoint.py index 17cff0e..214eebd 100755 --- a/docker/entrypoint.py +++ b/docker/entrypoint.py @@ -32,8 +32,9 @@ def change_uid_grp(): new_uid = int(os.getenv('UID', str(uid))) os.chown("/home/py-kms", new_uid, new_gid) os.chown("/usr/bin/start.py", new_uid, new_gid) - if os.path.isfile(dbPath): os.chown(dbPath, new_uid, new_gid) - loggersrv.debug("%s" %str(subprocess.check_output("ls -al " + dbPath, shell=True))) + if os.path.isfile(dbPath): + os.chown(dbPath, new_uid, new_gid) + loggersrv.debug("%s" %str(subprocess.check_output("ls -al " + dbPath, shell=True))) if gid != new_gid: loggersrv.info("Setting gid to '%s'." % str(new_gid)) os.setgid(gid) From 7f4fe7d003763a0f1af70dc549fffe8f5f873f66 Mon Sep 17 00:00:00 2001 From: Zhaofeng Yang Date: Mon, 1 Nov 2021 13:25:27 +0800 Subject: [PATCH 2/2] code style --- docker/entrypoint.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/entrypoint.py b/docker/entrypoint.py index 214eebd..57038fd 100755 --- a/docker/entrypoint.py +++ b/docker/entrypoint.py @@ -33,8 +33,9 @@ def change_uid_grp(): os.chown("/home/py-kms", new_uid, new_gid) os.chown("/usr/bin/start.py", new_uid, new_gid) if os.path.isfile(dbPath): - os.chown(dbPath, new_uid, new_gid) - loggersrv.debug("%s" %str(subprocess.check_output("ls -al " + dbPath, shell=True))) + os.chown(dbPath, new_uid, new_gid) + loggersrv.debug("%s" %str(subprocess.check_output("ls -al " + dbPath, shell=True))) + if gid != new_gid: loggersrv.info("Setting gid to '%s'." % str(new_gid)) os.setgid(gid)