From a694c3cafd7097bbf4fae11b76168b4c54d4ab53 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 18 Jul 2018 17:50:15 -0400 Subject: [PATCH] scripts/restart-server: Avoid shelling out for ln. Signed-off-by: Anders Kaseorg --- scripts/restart-server | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/restart-server b/scripts/restart-server index dd2a56033b..e8de5199e6 100755 --- a/scripts/restart-server +++ b/scripts/restart-server @@ -8,7 +8,7 @@ import logging import time sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -from scripts.lib.zulip_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR +from scripts.lib.zulip_tools import ENDC, OKGREEN, DEPLOYMENTS_DIR, overwrite_symlink logging.Formatter.converter = time.gmtime logging.basicConfig(format="%(asctime)s restart-server: %(message)s", @@ -34,8 +34,8 @@ if os.path.exists("/etc/supervisor/conf.d/thumbor.conf"): current_symlink = os.path.join(DEPLOYMENTS_DIR, "current") last_symlink = os.path.join(DEPLOYMENTS_DIR, "last") if os.readlink(current_symlink) != deploy_path: - subprocess.check_call(["ln", '-nsf', os.readlink(current_symlink), last_symlink]) - subprocess.check_call(["ln", '-nsf', deploy_path, current_symlink]) + overwrite_symlink(os.readlink(current_symlink), last_symlink) + overwrite_symlink(deploy_path, current_symlink) config_file = configparser.RawConfigParser() config_file.read("/etc/zulip/zulip.conf")