mirror of https://github.com/zulip/zulip.git
Move su_to_zulip into zulip_tools.py
(imported from commit 4a79f87dc396da9419a0a1cf5f5b7bb798d5b194)
This commit is contained in:
parent
81156cf2f5
commit
e8c104012b
|
@ -6,10 +6,10 @@ import logging
|
|||
import datetime
|
||||
import shutil
|
||||
import time
|
||||
import pwd
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
from zulip_tools import DEPLOYMENTS_DIR, LOCK_DIR, FAIL, WARNING, ENDC
|
||||
from zulip_tools import DEPLOYMENTS_DIR, LOCK_DIR, FAIL, WARNING, ENDC, \
|
||||
su_to_zulip
|
||||
|
||||
logging.basicConfig(format="%(asctime)s upgrade-zulip: %(message)s",
|
||||
level=logging.INFO)
|
||||
|
@ -44,11 +44,6 @@ if not got_lock:
|
|||
+ ENDC
|
||||
sys.exit(1)
|
||||
|
||||
def su_to_zulip():
|
||||
pwent = pwd.getpwnam("zulip")
|
||||
os.setgid(pwent.pw_gid)
|
||||
os.setuid(pwent.pw_uid)
|
||||
|
||||
logging.info("Unpacking the tarball")
|
||||
deploy_path = subprocess.check_output([os.path.join(os.path.dirname(__file__), 'unpack-zulip'),
|
||||
tarball_path], preexec_fn=su_to_zulip)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import os
|
||||
import sys
|
||||
import datetime
|
||||
import pwd
|
||||
|
||||
DEPLOYMENTS_DIR = "/home/zulip/deployments"
|
||||
LOCK_DIR = os.path.join(DEPLOYMENTS_DIR, "lock")
|
||||
|
@ -14,6 +15,11 @@ WARNING = '\033[93m'
|
|||
FAIL = '\033[91m'
|
||||
ENDC = '\033[0m'
|
||||
|
||||
def su_to_zulip():
|
||||
pwent = pwd.getpwnam("zulip")
|
||||
os.setgid(pwent.pw_gid)
|
||||
os.setuid(pwent.pw_uid)
|
||||
|
||||
def make_deploy_path():
|
||||
timestamp = datetime.datetime.now().strftime(TIMESTAMP_FORMAT)
|
||||
return os.path.join(DEPLOYMENTS_DIR, timestamp)
|
||||
|
|
Loading…
Reference in New Issue