scripts: Make upgrade-zulip-* use root checking from zulip_tools.

This is mostly just a nice code deduplication/cleanup.
This commit is contained in:
Rohitt Vashishtha
2018-11-15 10:07:43 +00:00
committed by Tim Abbott
parent cfe603f342
commit eae9251cb7
3 changed files with 9 additions and 15 deletions

View File

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