From c16c8e69f0a81548511537fd4b762ed6491c14a6 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Fri, 12 Apr 2019 23:59:43 +0530 Subject: [PATCH] Revert "fix: Change ownership of all log and config files (#787)" This reverts commit 2435cb6b2ea9e182b417c6f16b762647340aa573. --- bench/utils.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bench/utils.py b/bench/utils.py index 38b9d782..2d60e9fb 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -1,4 +1,4 @@ -import os, sys, shutil, subprocess, logging, itertools, requests, json, platform, select, pwd, grp, multiprocessing, hashlib, glob +import os, sys, shutil, subprocess, logging, itertools, requests, json, platform, select, pwd, grp, multiprocessing, hashlib from distutils.spawn import find_executable import bench import semantic_version @@ -556,6 +556,16 @@ def drop_privileges(uid_name='nobody', gid_name='nogroup'): def fix_prod_setup_perms(bench_path='.', frappe_user=None): from .config.common_site_config import get_config + files = [ + "logs/web.error.log", + "logs/web.log", + "logs/workerbeat.error.log", + "logs/workerbeat.log", + "logs/worker.error.log", + "logs/worker.log", + "config/nginx.conf", + "config/supervisor.conf", + ] if not frappe_user: frappe_user = get_config(bench_path).get('frappe_user') @@ -564,9 +574,8 @@ def fix_prod_setup_perms(bench_path='.', frappe_user=None): print("frappe user not set") sys.exit(1) - globs = ["logs/*", "config/*"] - for glob_name in globs: - for path in glob.glob(glob_name, recursive=True): + for path in files: + if os.path.exists(path): uid = pwd.getpwnam(frappe_user).pw_uid gid = grp.getgrnam(frappe_user).gr_gid os.chown(path, uid, gid)