mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 17:24:41 +00:00
fix(restart): Setup restarts vars with fallback
This commit is contained in:
parent
fc7c047c28
commit
af14bafe21
@ -320,6 +320,7 @@ def get_app(
|
||||
repo_name = app.repo
|
||||
branch = app.tag
|
||||
bench_setup = False
|
||||
restart_bench = not init_bench
|
||||
|
||||
if not is_bench_directory(bench_path):
|
||||
if not init_bench:
|
||||
@ -343,7 +344,6 @@ def get_app(
|
||||
"color": None,
|
||||
})
|
||||
|
||||
|
||||
cloned_path = os.path.join(bench_path, "apps", repo_name)
|
||||
dir_already_exists = os.path.isdir(cloned_path)
|
||||
to_clone = not dir_already_exists
|
||||
@ -368,7 +368,7 @@ def get_app(
|
||||
or overwrite
|
||||
or click.confirm("Do you want to reinstall the existing application?")
|
||||
):
|
||||
app.install(verbose=verbose, skip_assets=skip_assets)
|
||||
app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
|
||||
|
||||
|
||||
def new_app(app, no_git=None, bench_path="."):
|
||||
|
@ -138,9 +138,9 @@ class Bench(Base, Validator):
|
||||
|
||||
if conf.get("developer_mode"):
|
||||
restart_process_manager(bench_path=self.name, web_workers=web)
|
||||
if supervisor or conf.get("restart_supervisor_on_update"):
|
||||
if supervisor and conf.get("restart_supervisor_on_update"):
|
||||
restart_supervisor_processes(bench_path=self.name, web_workers=web)
|
||||
if systemd or conf.get("restart_systemd_on_update"):
|
||||
if systemd and conf.get("restart_systemd_on_update"):
|
||||
restart_systemd_processes(bench_path=self.name, web_workers=web)
|
||||
|
||||
def get_installed_apps(self) -> List:
|
||||
|
@ -6,7 +6,7 @@ import sys
|
||||
import click
|
||||
|
||||
# imports - module imports
|
||||
from bench.utils import exec_cmd, run_playbook
|
||||
from bench.utils import exec_cmd, run_playbook, which
|
||||
|
||||
|
||||
@click.group(help="Setup command group for enabling setting up a Frappe environment")
|
||||
@ -44,6 +44,8 @@ def setup_supervisor(user=None, yes=False, skip_redis=False):
|
||||
from bench.utils import get_cmd_output
|
||||
from bench.config.supervisor import update_supervisord_config, generate_supervisor_config
|
||||
|
||||
which("supervisorctl", raise_err=True)
|
||||
|
||||
if "Permission denied" in get_cmd_output("supervisorctl status"):
|
||||
update_supervisord_config(user=user, yes=yes)
|
||||
|
||||
|
@ -23,6 +23,9 @@ def start(no_dev, concurrency, procfile, no_prefix, man):
|
||||
@click.option('--systemd', is_flag=True, default=False)
|
||||
def restart(web, supervisor, systemd):
|
||||
from bench.bench import Bench
|
||||
if not systemd and not web:
|
||||
supervisor = True
|
||||
|
||||
Bench(".").reload(web, supervisor, systemd)
|
||||
|
||||
|
||||
|
@ -133,7 +133,7 @@ def which(executable: str, raise_err: bool = False) -> str:
|
||||
exec_ = which(executable)
|
||||
|
||||
if not exec_ and raise_err:
|
||||
raise ValueError(f"{executable} not found.")
|
||||
raise FileNotFoundError(f"{executable} not found in PATH")
|
||||
|
||||
return exec_
|
||||
|
||||
|
@ -258,6 +258,8 @@ def restart_supervisor_processes(bench_path=".", web_workers=False):
|
||||
supervisor_status = get_cmd_output("supervisorctl status", cwd=bench_path)
|
||||
except Exception as e:
|
||||
if e.returncode == 127:
|
||||
log("restart failed: Couldn't find supervisorctl in PATH", level=3)
|
||||
return
|
||||
sudo = "sudo "
|
||||
supervisor_status = get_cmd_output("sudo supervisorctl status", cwd=bench_path)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user