Skip to content

Commit

Permalink
Revert "fix: Change ownership of all log and config files (frappe#787)"
Browse files Browse the repository at this point in the history
This reverts commit 2435cb6.
  • Loading branch information
surajshetty3416 committed Apr 12, 2019
1 parent 431e969 commit c16c8e6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions bench/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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')
Expand All @@ -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)
Expand Down

0 comments on commit c16c8e6

Please sign in to comment.