unpack-zulip: Do 2-step upgrade for version <= 1.3.10.

If the current version is less than or equal to 1.3.10, first
recommend an upgrade to the version 1.4.3 and then to the final
version.
This commit is contained in:
Umair Khan
2017-06-21 17:32:22 +05:00
committed by showell
parent 090d7487cf
commit 908f099bb0
2 changed files with 34 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import datetime
import errno
import os
import pwd
import re
import shutil
import subprocess
import sys
@@ -25,6 +26,25 @@ ENDC = '\033[0m'
BLACKONYELLOW = '\x1b[0;30;43m'
WHITEONRED = '\x1b[0;37;41m'
def get_deployment_version(extract_path):
# type: (str) -> str
version = '0.0.0'
for item in os.listdir(extract_path):
item_path = os.path.join(extract_path, item)
if item.startswith('zulip-server') and os.path.isdir(item_path):
with open(os.path.join(item_path, 'version.py')) as f:
result = re.search('ZULIP_VERSION = "(.*)"', f.read())
if result:
version = result.groups()[0]
break
return version
def is_invalid_upgrade(current_version, new_version):
# type: (str, str) -> bool
if new_version > '1.4.3' and current_version <= '1.3.10':
return True
return False
def subprocess_text_output(args):
# type: (Sequence[str]) -> str
return subprocess.check_output(args, universal_newlines=True).strip()