scripts: Make manage.py use root checking from zulip_tools.

This commit is contained in:
Rohitt Vashishtha 2018-11-15 10:00:47 +00:00 committed by Tim Abbott
parent 0975bbb39e
commit cfe603f342
1 changed files with 2 additions and 3 deletions

View File

@ -6,11 +6,10 @@ import types
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
import scripts.lib.setup_path_on_import
from scripts.lib.zulip_tools import script_should_not_be_root
if __name__ == "__main__":
if 'posix' in os.name and os.geteuid() == 0:
print("manage.py should not be run as root. Use `su zulip` to drop root.")
sys.exit(1)
script_should_not_be_root()
if (os.access('/etc/zulip/zulip.conf', os.R_OK) and not
os.access('/etc/zulip/zulip-secrets.conf', os.R_OK)):
# The best way to detect running manage.py as another user in