mirror of https://github.com/zulip/zulip.git
scripts: Make upgrade-zulip-* use root checking from zulip_tools.
This is mostly just a nice code deduplication/cleanup.
This commit is contained in:
parent
cfe603f342
commit
eae9251cb7
|
@ -11,16 +11,14 @@ 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
|
||||
su_to_zulip, get_deployment_lock, release_deployment_lock, script_should_be_root
|
||||
|
||||
script_should_be_root(strip_lib_from_paths=True)
|
||||
|
||||
logging.Formatter.converter = time.gmtime
|
||||
logging.basicConfig(format="%(asctime)s upgrade-zulip: %(message)s",
|
||||
level=logging.INFO)
|
||||
|
||||
if os.getuid() != 0:
|
||||
logging.error("Must be run as root.")
|
||||
sys.exit(1)
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print(FAIL + "Usage: %s <tarball>" % (sys.argv[0],) + ENDC)
|
||||
sys.exit(1)
|
||||
|
|
|
@ -24,16 +24,14 @@ 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
|
||||
get_deployment_lock, release_deployment_lock, su_to_zulip, script_should_be_root
|
||||
|
||||
script_should_be_root(strip_lib_from_paths=True)
|
||||
|
||||
logging.Formatter.converter = time.gmtime
|
||||
logging.basicConfig(format="%(asctime)s upgrade-zulip-from-git: %(message)s",
|
||||
level=logging.INFO)
|
||||
|
||||
if os.getuid() != 0:
|
||||
logging.error("Must be run as root.")
|
||||
sys.exit(1)
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("refname", help="Git reference, e.g. a branch, tag, or commit ID.")
|
||||
parser.add_argument("--remote-url", dest="remote_url",
|
||||
|
|
|
@ -20,16 +20,14 @@ 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
|
||||
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, FAIL, WARNING, ENDC, su_to_zulip, script_should_be_root
|
||||
|
||||
script_should_be_root()
|
||||
|
||||
logging.Formatter.converter = time.gmtime
|
||||
logging.basicConfig(format="%(asctime)s upgrade-zulip-stage-2: %(message)s",
|
||||
level=logging.INFO)
|
||||
|
||||
if os.getuid() != 0:
|
||||
logging.error("Must be run as root.")
|
||||
sys.exit(1)
|
||||
|
||||
# make sure we have appropriate file permissions
|
||||
os.umask(0o22)
|
||||
|
||||
|
|
Loading…
Reference in New Issue