mirror of
https://github.com/frappe/bench.git
synced 2025-01-24 15:38:25 +00:00
v5 migration fixes
This commit is contained in:
parent
17c91f851d
commit
2b5df6f516
@ -104,7 +104,7 @@ def is_version_upgrade(bench='.'):
|
|||||||
upstream_version = get_major_version(upstream_version)
|
upstream_version = get_major_version(upstream_version)
|
||||||
|
|
||||||
if upstream_version - local_version > 0:
|
if upstream_version - local_version > 0:
|
||||||
return True
|
return (local_version, upstream_version)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_current_frappe_version(bench='.'):
|
def get_current_frappe_version(bench='.'):
|
||||||
|
16
bench/cli.py
16
bench/cli.py
@ -42,7 +42,7 @@ def cli():
|
|||||||
return old_frappe_cli()
|
return old_frappe_cli()
|
||||||
elif len(sys.argv) > 1 and sys.argv[1] in get_frappe_commands():
|
elif len(sys.argv) > 1 and sys.argv[1] in get_frappe_commands():
|
||||||
return frappe_cmd()
|
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()
|
return frappe_cmd()
|
||||||
elif len(sys.argv) > 1 and sys.argv[1]=="--help":
|
elif len(sys.argv) > 1 and sys.argv[1]=="--help":
|
||||||
print click.Context(bench).get_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
|
'upgrade': upgrade
|
||||||
})
|
})
|
||||||
|
|
||||||
|
version_upgrade = is_version_upgrade()
|
||||||
|
|
||||||
if is_version_upgrade() and not upgrade:
|
if version_upgrade and not upgrade:
|
||||||
print "This update will cause a major version change in Frappe/ERPNext."
|
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."
|
print "This would take significant time to migrate and might break custom apps. Please run `bench update --upgrade` to confirm."
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
@ -226,11 +227,12 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
|
|||||||
if pull:
|
if pull:
|
||||||
pull_all_apps()
|
pull_all_apps()
|
||||||
|
|
||||||
if upgrade:
|
|
||||||
pre_upgrade()
|
|
||||||
|
|
||||||
if requirements:
|
if requirements:
|
||||||
update_requirements()
|
update_requirements()
|
||||||
|
|
||||||
|
if upgrade:
|
||||||
|
pre_upgrade(version_upgrade[0], version_upgrade[1])
|
||||||
|
|
||||||
if patch:
|
if patch:
|
||||||
if not no_backup:
|
if not no_backup:
|
||||||
backup_all_sites()
|
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'):
|
if restart_supervisor or conf.get('restart_supervisor_on_update'):
|
||||||
restart_supervisor_processes()
|
restart_supervisor_processes()
|
||||||
if upgrade:
|
if upgrade:
|
||||||
post_upgrade()
|
post_upgrade(version_upgrade[0], version_upgrade[1])
|
||||||
|
|
||||||
print "_"*80
|
print "_"*80
|
||||||
print "https://frappe.io/buy - Donate to help make better free and open source tools"
|
print "https://frappe.io/buy - Donate to help make better free and open source tools"
|
||||||
|
@ -54,7 +54,6 @@ tcp-keepalive 0
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if redis_version == "2.8"%}
|
{% if redis_version == "2.8"%}
|
||||||
aof-load-truncated yes
|
|
||||||
aof-rewrite-incremental-fsync yes
|
aof-rewrite-incremental-fsync yes
|
||||||
appendfilename "appendonly.aof"
|
appendfilename "appendonly.aof"
|
||||||
client-output-buffer-limit normal 0 0 0
|
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
|
client-output-buffer-limit slave 256mb 64mb 60
|
||||||
hash-max-ziplist-entries 512
|
hash-max-ziplist-entries 512
|
||||||
hash-max-ziplist-value 64
|
hash-max-ziplist-value 64
|
||||||
hll-sparse-max-bytes 3000
|
|
||||||
hz 10
|
hz 10
|
||||||
latency-monitor-threshold 0
|
|
||||||
logfile ""
|
logfile ""
|
||||||
loglevel notice
|
loglevel notice
|
||||||
lua-time-limit 5000
|
lua-time-limit 5000
|
||||||
@ -72,6 +69,5 @@ notify-keyspace-events ""
|
|||||||
rdbchecksum yes
|
rdbchecksum yes
|
||||||
slave-read-only yes
|
slave-read-only yes
|
||||||
stop-writes-on-bgsave-error yes
|
stop-writes-on-bgsave-error yes
|
||||||
tcp-backlog 511
|
|
||||||
tcp-keepalive 0
|
tcp-keepalive 0
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -418,17 +418,16 @@ def run_frappe_cmd(*args, **kwargs):
|
|||||||
subprocess.check_call((f, '-m', 'frappe.utils.bench_helper', 'frappe') + args, cwd=sites_dir)
|
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
|
from .migrate_to_v5 import validate_v4, remove_shopping_cart
|
||||||
validate_v4(bench=bench)
|
if from_ver == 4 and to_ver == 5:
|
||||||
for repo in repos:
|
remove_shopping_cart(bench=bench)
|
||||||
checkout_v5(repo, bench=bench)
|
|
||||||
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 .app import get_current_frappe_version
|
||||||
from .config import generate_nginx_config, generate_supervisor_config, generate_redis_config
|
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"
|
print "Your bench was upgraded to version 5"
|
||||||
if conf.get('restart_supervisor_on_update'):
|
if conf.get('restart_supervisor_on_update'):
|
||||||
generate_redis_config(bench=bench)
|
generate_redis_config(bench=bench)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user