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:
Tim Abbott
2018-11-19 10:50:25 -08:00
parent eae9251cb7
commit 3e3eb2aa7f
6 changed files with 12 additions and 12 deletions

View File

@@ -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