2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-09 16:36:25 +00:00

[fix] validate upgrade

This commit is contained in:
Anand Doshi 2015-08-17 12:53:26 +05:30
parent 28af30ca3a
commit 0e0ac03f8c
2 changed files with 8 additions and 4 deletions

View File

@ -14,7 +14,7 @@ from .utils import (build_assets, patch_sites, exec_cmd, update_bench, get_env_c
get_config, update_config, restart_supervisor_processes, put_config, default_config, update_requirements,
backup_all_sites, backup_site, get_sites, prime_wheel_cache, is_root, set_mariadb_host, drop_privileges,
fix_file_perms, fix_prod_setup_perms, set_ssl_certificate, set_ssl_certificate_key, get_cmd_output, post_upgrade,
pre_upgrade, PatchError, download_translations_p, setup_socketio)
pre_upgrade, validate_upgrade, PatchError, download_translations_p, setup_socketio)
from .app import get_app as _get_app
from .app import new_app as _new_app
from .app import pull_all_apps, get_apps, get_current_frappe_version, is_version_upgrade, switch_to_v4, switch_to_master, switch_to_develop
@ -249,6 +249,9 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
if version_upgrade and not upgrade:
raise Exception("Major Version Upgrade")
if upgrade:
validate_upgrade(version_upgrade[0], version_upgrade[1], bench=bench_path)
if pull:
pull_all_apps(bench=bench_path)

View File

@ -495,6 +495,10 @@ def get_frappe_cmd_output(*args, **kwargs):
sites_dir = os.path.join(bench, 'sites')
return subprocess.check_output((f, '-m', 'frappe.utils.bench_helper', 'frappe') + args, cwd=sites_dir)
def validate_upgrade(from_ver, to_ver, bench='.'):
if to_ver >= 6:
if not find_executable('npm') and not find_executable('node'):
raise Exception("Please install nodejs and npm")
def pre_upgrade(from_ver, to_ver, bench='.'):
from .migrate_to_v5 import remove_shopping_cart
@ -508,9 +512,6 @@ def pre_upgrade(from_ver, to_ver, bench='.'):
if os.path.exists(cwd):
exec_cmd("git clean -dxf", cwd=cwd)
exec_cmd("{pip} install --upgrade -e {app}".format(pip=pip, app=cwd))
if to_ver >= 6:
if not find_executable('npm') and not find_executable('node'):
raise Exception("Please install nodejs and npm")
def post_upgrade(from_ver, to_ver, bench='.'):
from .config import generate_nginx_config, generate_supervisor_config, generate_redis_cache_config, generate_redis_async_broker_config