From f08d7e2605fec43515599c96956058df2e11643c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 9 Jun 2016 18:50:13 +0530 Subject: [PATCH] [fix] update bench before upgrade check --- bench/commands/update.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/bench/commands/update.py b/bench/commands/update.py index b570074c..3df1ecc1 100644 --- a/bench/commands/update.py +++ b/bench/commands/update.py @@ -24,28 +24,12 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar if not (pull or patch or build or bench or requirements): pull, patch, build, bench, requirements = True, True, True, True, True - patches.run(bench_path='.') - - conf = get_config(".") - - version_upgrade = is_version_upgrade() - - if version_upgrade[0] and not upgrade: - print - print - print "This update will cause a major version change in Frappe/ERPNext from {0} to {1}.".format(*version_upgrade[1:]) - print "This would take significant time to migrate and might break custom apps. Please run `bench update --upgrade` to confirm." - print - print "You can stay on the latest stable release by running `bench switch-to-master` or pin your bench to {0} by running `bench switch-to-v{0}`".format(version_upgrade[1]) - sys.exit(1) - - if conf.get('release_bench'): - print 'Release bench, cannot update' - sys.exit(1) - if auto: sys.exit(1) + patches.run(bench_path='.') + conf = get_config(".") + if bench and conf.get('update_bench_on_update'): update_bench() restart_update({ @@ -58,6 +42,21 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar 'upgrade': upgrade }) + if conf.get('release_bench'): + print 'Release bench, cannot update' + sys.exit(1) + + version_upgrade = is_version_upgrade() + + if version_upgrade[0] and not upgrade: + print + print + print "This update will cause a major version change in Frappe/ERPNext from {0} to {1}.".format(*version_upgrade[1:]) + print "This would take significant time to migrate and might break custom apps. Please run `bench update --upgrade` to confirm." + print + print "You can stay on the latest stable release by running `bench switch-to-master` or pin your bench to {0} by running `bench switch-to-v{0}`".format(version_upgrade[1]) + sys.exit(1) + _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)