mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
scripts/upgrade-zulip-from-git: Avoid shelling out for mkdir, ln.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Tim Abbott
parent
a61eebd9e3
commit
d581ad82ca
@@ -24,7 +24,7 @@ os.environ["PYTHONUNBUFFERED"] = "y"
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, make_deploy_path, \
|
||||
get_deployment_lock, release_deployment_lock, su_to_zulip, assert_running_as_root
|
||||
get_deployment_lock, overwrite_symlink, release_deployment_lock, su_to_zulip, assert_running_as_root
|
||||
|
||||
assert_running_as_root(strip_lib_from_paths=True)
|
||||
|
||||
@@ -44,9 +44,8 @@ refname = args.refname
|
||||
if args.remote_url:
|
||||
remote_url = args.remote_url
|
||||
|
||||
subprocess.check_call(["mkdir", '-p',
|
||||
DEPLOYMENTS_DIR,
|
||||
'/home/zulip/logs'])
|
||||
os.makedirs(DEPLOYMENTS_DIR, exist_ok=True)
|
||||
os.makedirs('/home/zulip/logs', exist_ok=True)
|
||||
|
||||
error_rerun_script = "%s/current/scripts/upgrade-zulip-from-git %s" % (DEPLOYMENTS_DIR, refname)
|
||||
get_deployment_lock(error_rerun_script)
|
||||
@@ -69,10 +68,9 @@ try:
|
||||
preexec_fn=su_to_zulip)
|
||||
os.chdir(deploy_path)
|
||||
|
||||
subprocess.check_call(["ln", "-nsf", "/etc/zulip/settings.py",
|
||||
os.path.join(deploy_path, "zproject/prod_settings.py")])
|
||||
overwrite_symlink("/etc/zulip/settings.py", "zproject/prod_settings.py")
|
||||
|
||||
subprocess.check_call(["ln", '-nsf', deploy_path, os.path.join(DEPLOYMENTS_DIR, "next")])
|
||||
overwrite_symlink(deploy_path, os.path.join(DEPLOYMENTS_DIR, "next"))
|
||||
|
||||
subprocess.check_call([os.path.join(deploy_path, "scripts", "lib", "upgrade-zulip-stage-2"),
|
||||
deploy_path, "--from-git"] + deploy_options)
|
||||
|
||||
Reference in New Issue
Block a user