2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-11 15:51:03 +00:00

v5 migration fixes

This commit is contained in:
Pratik Vyas 2015-03-05 16:34:28 +05:30
parent 17c91f851d
commit 2b5df6f516
4 changed files with 16 additions and 19 deletions

View File

@ -104,7 +104,7 @@ def is_version_upgrade(bench='.'):
upstream_version = get_major_version(upstream_version)
if upstream_version - local_version > 0:
return True
return (local_version, upstream_version)
return False
def get_current_frappe_version(bench='.'):

View File

@ -42,7 +42,7 @@ def cli():
return old_frappe_cli()
elif len(sys.argv) > 1 and sys.argv[1] in get_frappe_commands():
return frappe_cmd()
elif len(sys.argv) > 1 and sys.argv[1] in ("--site", "--verbose", "--force"):
elif len(sys.argv) > 1 and sys.argv[1] in ("--site", "--verbose", "--force", "--profile"):
return frappe_cmd()
elif len(sys.argv) > 1 and sys.argv[1]=="--help":
print click.Context(bench).get_help()
@ -215,9 +215,10 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
'upgrade': upgrade
})
version_upgrade = is_version_upgrade()
if is_version_upgrade() and not upgrade:
print "This update will cause a major version change in Frappe/ERPNext."
if version_upgrade and not upgrade:
print "This update will cause a major version change in Frappe/ERPNext from {0} to {1}.".format(*version_upgrade)
print "This would take significant time to migrate and might break custom apps. Please run `bench update --upgrade` to confirm."
sys.exit(1)
else:
@ -226,11 +227,12 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
if pull:
pull_all_apps()
if upgrade:
pre_upgrade()
if requirements:
update_requirements()
if upgrade:
pre_upgrade(version_upgrade[0], version_upgrade[1])
if patch:
if not no_backup:
backup_all_sites()
@ -240,7 +242,7 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
if restart_supervisor or conf.get('restart_supervisor_on_update'):
restart_supervisor_processes()
if upgrade:
post_upgrade()
post_upgrade(version_upgrade[0], version_upgrade[1])
print "_"*80
print "https://frappe.io/buy - Donate to help make better free and open source tools"

View File

@ -54,7 +54,6 @@ tcp-keepalive 0
{% endif %}
{% if redis_version == "2.8"%}
aof-load-truncated yes
aof-rewrite-incremental-fsync yes
appendfilename "appendonly.aof"
client-output-buffer-limit normal 0 0 0
@ -62,9 +61,7 @@ client-output-buffer-limit pubsub 32mb 8mb 60
client-output-buffer-limit slave 256mb 64mb 60
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
hll-sparse-max-bytes 3000
hz 10
latency-monitor-threshold 0
logfile ""
loglevel notice
lua-time-limit 5000
@ -72,6 +69,5 @@ notify-keyspace-events ""
rdbchecksum yes
slave-read-only yes
stop-writes-on-bgsave-error yes
tcp-backlog 511
tcp-keepalive 0
{% endif %}

View File

@ -418,17 +418,16 @@ def run_frappe_cmd(*args, **kwargs):
subprocess.check_call((f, '-m', 'frappe.utils.bench_helper', 'frappe') + args, cwd=sites_dir)
def pre_upgrade(bench='.')
def pre_upgrade(from_ver, to_ver, bench='.'):
from .migrate_to_v5 import validate_v4, remove_shopping_cart
validate_v4(bench=bench)
for repo in repos:
checkout_v5(repo, bench=bench)
remove_shopping_cart(bench=bench)
if from_ver == 4 and to_ver == 5:
remove_shopping_cart(bench=bench)
def post_upgrade(bench='.'):
def post_upgrade(from_ver, to_ver, bench='.'):
from .app import get_current_frappe_version
from .config import generate_nginx_config, generate_supervisor_config, generate_redis_config
if get_current_frappe_version() == 5:
conf = get_config(bench=bench)
if from_ver == 4 and to_ver == 5:
print "Your bench was upgraded to version 5"
if conf.get('restart_supervisor_on_update'):
generate_redis_config(bench=bench)