mirror of
https://github.com/frappe/bench.git
synced 2025-01-24 15:38:25 +00:00
bench update restarts systemd if specified
This commit is contained in:
parent
624e8bdf63
commit
b94a5e63b9
@ -3,7 +3,8 @@ import sys, os
|
|||||||
from bench.config.common_site_config import get_config
|
from bench.config.common_site_config import get_config
|
||||||
from bench.app import pull_all_apps, is_version_upgrade
|
from bench.app import pull_all_apps, is_version_upgrade
|
||||||
from bench.utils import (update_bench, validate_upgrade, pre_upgrade, post_upgrade, before_update,
|
from bench.utils import (update_bench, validate_upgrade, pre_upgrade, post_upgrade, before_update,
|
||||||
update_requirements, update_node_packages, backup_all_sites, patch_sites, build_assets, restart_supervisor_processes)
|
update_requirements, update_node_packages, backup_all_sites, patch_sites, build_assets,
|
||||||
|
restart_supervisor_processes, restart_systemd_processes)
|
||||||
from bench import patches
|
from bench import patches
|
||||||
|
|
||||||
#TODO: Not DRY
|
#TODO: Not DRY
|
||||||
@ -14,11 +15,12 @@ from bench import patches
|
|||||||
@click.option('--bench',is_flag=True, help="Update bench")
|
@click.option('--bench',is_flag=True, help="Update bench")
|
||||||
@click.option('--requirements',is_flag=True, help="Update requirements")
|
@click.option('--requirements',is_flag=True, help="Update requirements")
|
||||||
@click.option('--restart-supervisor',is_flag=True, help="restart supervisor processes after update")
|
@click.option('--restart-supervisor',is_flag=True, help="restart supervisor processes after update")
|
||||||
|
@click.option('--restart-systemd',is_flag=True, help="restart systemd units after update")
|
||||||
@click.option('--auto',is_flag=True)
|
@click.option('--auto',is_flag=True)
|
||||||
@click.option('--no-backup',is_flag=True)
|
@click.option('--no-backup',is_flag=True)
|
||||||
@click.option('--force',is_flag=True)
|
@click.option('--force',is_flag=True)
|
||||||
@click.option('--reset', is_flag=True, help="Hard resets git branch's to their new states overriding any changes and overriding rebase on pull")
|
@click.option('--reset', is_flag=True, help="Hard resets git branch's to their new states overriding any changes and overriding rebase on pull")
|
||||||
def update(pull=False, patch=False, build=False, bench=False, auto=False, restart_supervisor=False, requirements=False, no_backup=False, force=False, reset=False):
|
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"
|
"Update bench"
|
||||||
|
|
||||||
if not (pull or patch or build or bench or requirements):
|
if not (pull or patch or build or bench or requirements):
|
||||||
@ -55,10 +57,10 @@ def update(pull=False, patch=False, build=False, bench=False, auto=False, restar
|
|||||||
print("This would take significant time to migrate and might break custom apps.")
|
print("This would take significant time to migrate and might break custom apps.")
|
||||||
click.confirm('Do you want to continue?', abort=True)
|
click.confirm('Do you want to continue?', abort=True)
|
||||||
|
|
||||||
_update(pull, patch, build, bench, auto, restart_supervisor, requirements, no_backup, force=force, reset=reset)
|
_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,
|
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):
|
restart_systemd=False, requirements=False, no_backup=False, bench_path='.', force=False, reset=False):
|
||||||
conf = get_config(bench_path=bench_path)
|
conf = get_config(bench_path=bench_path)
|
||||||
version_upgrade = is_version_upgrade(bench_path=bench_path)
|
version_upgrade = is_version_upgrade(bench_path=bench_path)
|
||||||
|
|
||||||
@ -94,6 +96,8 @@ def _update(pull=False, patch=False, build=False, update_bench=False, auto=False
|
|||||||
post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path)
|
post_upgrade(version_upgrade[1], version_upgrade[2], bench_path=bench_path)
|
||||||
if restart_supervisor or conf.get('restart_supervisor_on_update'):
|
if restart_supervisor or conf.get('restart_supervisor_on_update'):
|
||||||
restart_supervisor_processes(bench_path=bench_path)
|
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("_"*80)
|
||||||
print("Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).")
|
print("Bench: Deployment tool for Frappe and ERPNext (https://erpnext.org).")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user