mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 20:02:15 +00:00
scripts: Clarify names of running-as-root assertions.
This should make it more obvious that these functions will exit the script if the check fails.
This commit is contained in:
@@ -11,9 +11,9 @@ 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, \
|
||||
su_to_zulip, get_deployment_lock, release_deployment_lock, script_should_be_root
|
||||
su_to_zulip, get_deployment_lock, release_deployment_lock, assert_running_as_root
|
||||
|
||||
script_should_be_root(strip_lib_from_paths=True)
|
||||
assert_running_as_root(strip_lib_from_paths=True)
|
||||
|
||||
logging.Formatter.converter = time.gmtime
|
||||
logging.basicConfig(format="%(asctime)s upgrade-zulip: %(message)s",
|
||||
|
||||
@@ -24,9 +24,9 @@ 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, script_should_be_root
|
||||
get_deployment_lock, release_deployment_lock, su_to_zulip, assert_running_as_root
|
||||
|
||||
script_should_be_root(strip_lib_from_paths=True)
|
||||
assert_running_as_root(strip_lib_from_paths=True)
|
||||
|
||||
logging.Formatter.converter = time.gmtime
|
||||
logging.basicConfig(format="%(asctime)s upgrade-zulip-from-git: %(message)s",
|
||||
|
||||
@@ -20,9 +20,9 @@ os.environ["LANG"] = "en_US.UTF-8"
|
||||
os.environ["LANGUAGE"] = "en_US.UTF-8"
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
|
||||
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, su_to_zulip, script_should_be_root
|
||||
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, su_to_zulip, assert_running_as_root
|
||||
|
||||
script_should_be_root()
|
||||
assert_running_as_root()
|
||||
|
||||
logging.Formatter.converter = time.gmtime
|
||||
logging.basicConfig(format="%(asctime)s upgrade-zulip-stage-2: %(message)s",
|
||||
|
||||
@@ -365,7 +365,7 @@ def is_root() -> bool:
|
||||
return True
|
||||
return False
|
||||
|
||||
def script_should_not_be_root() -> None:
|
||||
def assert_not_running_as_root() -> None:
|
||||
script_name = os.path.abspath(sys.argv[0])
|
||||
if is_root():
|
||||
msg = ("{shortname} should not be run as root. Use `su zulip` to switch to the 'zulip'\n"
|
||||
@@ -376,7 +376,7 @@ def script_should_not_be_root() -> None:
|
||||
print(msg)
|
||||
sys.exit(1)
|
||||
|
||||
def script_should_be_root(strip_lib_from_paths: bool=False) -> None:
|
||||
def assert_running_as_root(strip_lib_from_paths: bool=False) -> None:
|
||||
script_name = os.path.abspath(sys.argv[0])
|
||||
# Since these Python scripts are run inside a thin shell wrapper,
|
||||
# we need to replace the paths in order to ensure we instruct
|
||||
|
||||
Reference in New Issue
Block a user