def _update(pull=False, patch=False, build=False, update_bench=False, auto=False, restart_supervisor=False, restart_systemd=False, requirements=False, no_backup=False, bench_path='.', force=False, reset=False): conf = get_config(bench_path=bench_path) version_upgrade = is_version_upgrade(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): validate_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) before_update(bench_path=bench_path, requirements=requirements) if pull: pull_all_apps(bench_path=bench_path, reset=reset) if requirements: update_requirements(bench_path=bench_path) update_node_packages(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): pre_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) import bench.utils, bench.app print('Reloading bench...') if sys.version_info >= (3, 4): import importlib importlib.reload(bench.utils) importlib.reload(bench.app) else: reload(bench.utils) reload(bench.app) if patch: if not no_backup: print('Backing up sites...') backup_all_sites(bench_path=bench_path) print('Patching sites...') patch_sites(bench_path=bench_path) if build: build_assets(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) if restart_supervisor or conf.get('restart_supervisor_on_update'): restart_supervisor_processes(bench_path=bench_path) if restart_systemd or conf.get('restart_systemd_on_update'): restart_systemd_processes(bench_path=bench_path) print("_"*80) print("Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).") print("Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community") print()
def _update(pull=False, patch=False, build=False, update_bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, upgrade=False, bench_path='.', force=False, reset=False): conf = get_config(bench_path=bench_path) version_upgrade = is_version_upgrade(bench_path=bench_path) if version_upgrade[0] and not upgrade: raise Exception("Major Version Upgrade") if upgrade and (version_upgrade[0] or (not version_upgrade[0] and force)): validate_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) before_update(bench_path=bench_path, requirements=requirements) if pull: pull_all_apps(bench_path=bench_path, reset=reset) if requirements: print 'Updating Python libraries...' update_requirements(bench_path=bench_path) if upgrade and (version_upgrade[0] or (not version_upgrade[0] and force)): pre_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) import bench.utils, bench.app print 'Reloading bench...' reload(bench.utils) reload(bench.app) if patch: if not no_backup: print 'Backing up sites...' backup_all_sites(bench_path=bench_path) print 'Patching sites...' patch_sites(bench_path=bench_path) if build: build_assets(bench_path=bench_path) if upgrade and (version_upgrade[0] or (not version_upgrade[0] and force)): post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) if restart_supervisor or conf.get('restart_supervisor_on_update'): restart_supervisor_processes(bench_path=bench_path) print "_"*80 print "Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org)." print "Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community" print
def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, upgrade=False, force=False): "Update bench" 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) if bench and conf.get('update_bench_on_update'): update_bench() restart_update({ 'pull': pull, 'patch': patch, 'build': build, 'requirements': requirements, 'no-backup': no_backup, 'restart-supervisor': restart_supervisor, 'upgrade': upgrade }) _update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, upgrade, force=force)
def _update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, upgrade=False, bench_path='.', force=False): conf = get_config(bench=bench_path) version_upgrade = is_version_upgrade(bench=bench_path) if version_upgrade[0] and not upgrade: raise Exception("Major Version Upgrade") if upgrade and (version_upgrade[0] or (not version_upgrade[0] and force)): validate_upgrade(version_upgrade[1], version_upgrade[2], bench=bench_path) before_update(bench=bench_path, requirements=requirements) if pull: pull_all_apps(bench=bench_path) if requirements: update_requirements(bench=bench_path) if upgrade and (version_upgrade[0] or (not version_upgrade[0] and force)): pre_upgrade(version_upgrade[1], version_upgrade[2], bench=bench_path) import utils, app reload(utils) reload(app) if patch: if not no_backup: backup_all_sites(bench=bench_path) patch_sites(bench=bench_path) if build: build_assets(bench=bench_path) if upgrade and (version_upgrade[0] or (not version_upgrade[0] and force)): post_upgrade(version_upgrade[1], version_upgrade[2], bench=bench_path) if restart_supervisor or conf.get('restart_supervisor_on_update'): restart_supervisor_processes(bench=bench_path) print "_"*80 print "Bench: Open source installer + admin for Frappe and ERPNext (https://erpnext.com)" print
def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, restart_systemd=False, requirements=False, no_backup=False, force=False, reset=False): "Update bench" if not (pull or patch or build or bench or requirements): pull, patch, build, bench, requirements = True, True, True, True, True 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({ 'pull': pull, 'patch': patch, 'build': build, 'requirements': requirements, 'no-backup': no_backup, 'restart-supervisor': restart_supervisor, 'reset': reset }) if conf.get('release_bench'): print('Release bench, cannot update') sys.exit(1) version_upgrade = is_version_upgrade() if version_upgrade[0]: 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.") click.confirm('Do you want to continue?', abort=True) _update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
def _update(pull=False, patch=False, build=False, update_bench=False, auto=False, restart_supervisor=False, restart_systemd=False, requirements=False, no_backup=False, bench_path='.', force=False, reset=False): conf = get_config(bench_path=bench_path) version_upgrade = is_version_upgrade(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): validate_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) before_update(bench_path=bench_path, requirements=requirements) conf.update({"maintenance_mode": 1, "pause_scheduler": 1}) update_config(conf, bench_path=bench_path) if not no_backup: print('Backing up sites...') backup_all_sites(bench_path=bench_path) if pull: pull_all_apps(bench_path=bench_path, reset=reset) if requirements: update_requirements(bench_path=bench_path) update_node_packages(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): pre_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) import bench.utils, bench.app print('Reloading bench...') reload_module(bench.utils) reload_module(bench.app) if patch: print('Patching sites...') patch_sites(bench_path=bench_path) if build: build_assets(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) if restart_supervisor or conf.get('restart_supervisor_on_update'): restart_supervisor_processes(bench_path=bench_path) if restart_systemd or conf.get('restart_systemd_on_update'): restart_systemd_processes(bench_path=bench_path) conf.update({"maintenance_mode": 0, "pause_scheduler": 0}) update_config(conf, bench_path=bench_path) print("_" * 80) print( "Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).") print( "Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community" ) print()
def update(pull=False, apps=None, patch=False, build=False, requirements=False, backup=True, compile=True, force=False, reset=False, restart_supervisor=False, restart_systemd=False): """command: bench update""" from bench import patches from bench.app import is_version_upgrade, pull_apps, validate_branch from bench.config.common_site_config import get_config, update_config bench_path = os.path.abspath(".") patches.run(bench_path=bench_path) conf = get_config(bench_path) if apps and not pull: apps = [] clear_command_cache(bench_path='.') if conf.get('release_bench'): print('Release bench detected, cannot update!') sys.exit(1) if not (pull or patch or build or requirements): pull, patch, build, requirements = True, True, True, True validate_branch() version_upgrade = is_version_upgrade() if version_upgrade[0]: if force: print( "Force flag has been used for a major version change in Frappe and it's apps. \nThis will take significant time to migrate and might break custom apps." ) else: print( "This update will cause a major version change in Frappe/ERPNext from {0} to {1}. \nThis would take significant time to migrate and might break custom apps." .format(*version_upgrade[1:])) click.confirm('Do you want to continue?', abort=True) if version_upgrade[0] or (not version_upgrade[0] and force): validate_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) conf.update({"maintenance_mode": 1, "pause_scheduler": 1}) update_config(conf, bench_path=bench_path) if backup: print('Backing up sites...') backup_all_sites(bench_path=bench_path) if apps: apps = [app.strip() for app in re.split(",| ", apps) if app] if pull: pull_apps(apps=apps, bench_path=bench_path, reset=reset) if requirements: update_requirements(bench_path=bench_path) update_node_packages(bench_path=bench_path) if patch: print('Patching sites...') patch_sites(bench_path=bench_path) if build: build_assets(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) if pull and compile: print("Compiling Python files...") compileall.compile_dir('../apps', quiet=1, rx=re.compile('.*node_modules.*')) if restart_supervisor or conf.get('restart_supervisor_on_update'): restart_supervisor_processes(bench_path=bench_path) if restart_systemd or conf.get('restart_systemd_on_update'): restart_systemd_processes(bench_path=bench_path) conf.update({"maintenance_mode": 0, "pause_scheduler": 0}) update_config(conf, bench_path=bench_path) print( "_" * 80 + "\nBench: Deployment tool for Frappe and Frappe Applications (https://frappe.io/bench).\nOpen source depends on your contributions, so do give back by submitting bug reports, patches and fixes and be a part of the community :)" )
def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, restart_systemd=False, requirements=False, no_backup=False, force=False, reset=False): "Update bench" if not (pull or patch or build or bench or requirements): pull, patch, build, bench, requirements = True, True, True, True, True 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({ 'pull': pull, 'patch': patch, 'build': build, 'requirements': requirements, 'no-backup': no_backup, 'restart-supervisor': restart_supervisor, 'reset': reset }) if conf.get('release_bench'): print('Release bench, cannot update') sys.exit(1) version_upgrade = is_version_upgrade() if version_upgrade[0]: 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." ) click.confirm('Do you want to continue?', abort=True) _update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, upgrade=False, force=False, reset=False, force_frappe=False, force_erpnext=False, force_frappe_erpnext=False): "Update bench" print "force_frape {0}".format(force_frappe) if not (pull or patch or build or bench or requirements): pull, patch, build, bench, requirements = True, True, True, True, True 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({ # 'pull': pull, # 'patch': patch, # 'build': build, # 'requirements': requirements, # 'no-backup': no_backup, # 'restart-supervisor': restart_supervisor, # 'upgrade': upgrade, # 'reset': reset # }) 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, reset=reset, force_frappe=force_frappe, force_erpnext=force_erpnext, force_frappe_erpnext=force_frappe_erpnext)
def update(pull=False, patch=False, build=False, bench=False, restart_supervisor=False, restart_systemd=False, requirements=False, backup=True, force=False, reset=False): """command: bench update""" if not is_bench_directory(): """Update only bench CLI if bench update called from outside a bench""" update_bench(bench_repo=True, requirements=True) sys.exit(0) from bench import patches from bench.app import is_version_upgrade, pull_all_apps, validate_branch from bench.config.common_site_config import get_config, update_config bench_path = os.path.abspath(".") patches.run(bench_path=bench_path) conf = get_config(bench_path) if conf.get('release_bench'): print('Release bench detected, cannot update!') sys.exit(1) if not (pull or patch or build or bench or requirements): pull, patch, build, bench, requirements = True, True, True, True, True if bench and conf.get('update_bench_on_update'): update_bench(bench_repo=True, requirements=False) restart_update({ 'pull': pull, 'patch': patch, 'build': build, 'requirements': requirements, 'no-backup': backup, 'restart-supervisor': restart_supervisor, 'reset': reset }) validate_branch() version_upgrade = is_version_upgrade() if version_upgrade[0]: if force: print( "Force flag has been used for a major version change in Frappe and it's apps. \nThis will take significant time to migrate and might break custom apps." ) else: print( "This update will cause a major version change in Frappe/ERPNext from {0} to {1}. \nThis would take significant time to migrate and might break custom apps." .format(*version_upgrade[1:])) click.confirm('Do you want to continue?', abort=True) if version_upgrade[0] or (not version_upgrade[0] and force): validate_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) before_update(bench_path=bench_path, requirements=requirements) conf.update({"maintenance_mode": 1, "pause_scheduler": 1}) update_config(conf, bench_path=bench_path) if backup: print('Backing up sites...') backup_all_sites(bench_path=bench_path) if pull: pull_all_apps(bench_path=bench_path, reset=reset) if requirements: update_requirements(bench_path=bench_path) update_node_packages(bench_path=bench_path) if patch: print('Patching sites...') patch_sites(bench_path=bench_path) if build: build_assets(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) if restart_supervisor or conf.get('restart_supervisor_on_update'): restart_supervisor_processes(bench_path=bench_path) if restart_systemd or conf.get('restart_systemd_on_update'): restart_systemd_processes(bench_path=bench_path) conf.update({"maintenance_mode": 0, "pause_scheduler": 0}) update_config(conf, bench_path=bench_path) print( "_" * 80 + "\nBench: Deployment tool for Frappe and Frappe Applications (https://frappe.io/bench).\nOpen source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community" )
def _update(pull=False, patch=False, build=False, update_bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, bench_path='.', force=False, reset=False): conf = get_config(bench_path=bench_path) version_upgrade = is_version_upgrade(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): validate_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) before_update(bench_path=bench_path, requirements=requirements) if pull: pull_all_apps(bench_path=bench_path, reset=reset) if requirements: update_requirements(bench_path=bench_path) update_npm_packages(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): pre_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) import bench.utils, bench.app print('Reloading bench...') reload(bench.utils) reload(bench.app) if patch: if not no_backup: print('Backing up sites...') backup_all_sites(bench_path=bench_path) print('Patching sites...') patch_sites(bench_path=bench_path) if build: build_assets(bench_path=bench_path) if version_upgrade[0] or (not version_upgrade[0] and force): post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path) if restart_supervisor or conf.get('restart_supervisor_on_update'): restart_supervisor_processes(bench_path=bench_path) print("_" * 80) print( "Bench: Deployment tool for Revaluesoft and Revalue ERP (http://revaluesoft.com)." ) print( "Open source depends on your contributions, so please contribute bug reports, patches, fixes or cash and be a part of the community" ) print()