コード例 #1
0
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 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()
コード例 #2
0
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,
            force_frappe=False,
            force_erpnext=False,
            force_frappe_erpnext=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,
                      force_frappe=force_frappe,
                      force_erpnext=force_erpnext,
                      force_frappe_erpnext=force_frappe_erpnext)

    # if requirements:
    #     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
        reload(bench.utils)
        reload(bench.app)

    if patch:
        if not no_backup:
            backup_all_sites(bench_path=bench_path)
        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: Open source installer + admin for Frappe and ERPNext (https://erpnext.com)"
    print
コード例 #3
0
ファイル: update.py プロジェクト: frappe/bench
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()
コード例 #4
0
ファイル: update.py プロジェクト: ckosiegbu/bench
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
コード例 #5
0
ファイル: update.py プロジェクト: Dattatech/Test-Bench
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
コード例 #6
0
ファイル: utils.py プロジェクト: ccfiel/bench
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"
    )
コード例 #7
0
def retry_upgrade(version):
    pull_all_apps()
    patch_sites()
    build_assets()
    post_upgrade(version - 1, version)
コード例 #8
0
ファイル: update.py プロジェクト: Dattatech/Test-Bench
def retry_upgrade(version):
	pull_all_apps()
	patch_sites()
	build_assets()
	post_upgrade(version-1, version)