2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 09:02:10 +00:00

Merge branch 'staging' into v5.x

This commit is contained in:
Gavin D'souza 2022-08-03 16:50:38 +05:30
commit 155524b769
4 changed files with 8 additions and 9 deletions

View File

@ -5,7 +5,7 @@
"@semantic-release/release-notes-generator", "@semantic-release/release-notes-generator",
[ [
"@semantic-release/exec", { "@semantic-release/exec", {
"prepareCmd": 'sed -ir "s/[0-9]*\.[0-9]*\.[0-9]*/${nextRelease.version}/" bench/__init__.py' "prepareCmd": 'sed -ir -E "s/\"[0-9]+\.[0-9]+\.[0-9]+\"/\"${nextRelease.version}\"/" bench/__init__.py'
} }
], ],
[ [

View File

@ -13,6 +13,7 @@ from bench.utils import exec_cmd, get_bench_name, get_cmd_output
def is_sudoers_set(): def is_sudoers_set():
"""Check if bench sudoers is set""" """Check if bench sudoers is set"""
cmd = ["sudo", "-n", "bench"] cmd = ["sudo", "-n", "bench"]
bench_warn = False
with open(os.devnull, "wb") as f: with open(os.devnull, "wb") as f:
return_code_check = not subprocess.call(cmd, stdout=f) return_code_check = not subprocess.call(cmd, stdout=f)

View File

@ -63,9 +63,10 @@ def is_valid_frappe_branch(frappe_path: str, frappe_branch: str):
:type frappe_branch: str :type frappe_branch: str
:raises InvalidRemoteException: branch for this repo doesn't exist :raises InvalidRemoteException: branch for this repo doesn't exist
""" """
import git from git.cmd import Git
from git.exc import GitCommandError
g = git.cmd.Git() g = Git()
if frappe_branch: if frappe_branch:
try: try:
@ -74,8 +75,8 @@ def is_valid_frappe_branch(frappe_path: str, frappe_branch: str):
raise InvalidRemoteException( raise InvalidRemoteException(
f"Invalid branch or tag: {frappe_branch} for the remote {frappe_path}" f"Invalid branch or tag: {frappe_branch} for the remote {frappe_path}"
) )
except git.exc.GitCommandError: except GitCommandError as e:
raise InvalidRemoteException(f"Invalid frappe path: {frappe_path}") raise InvalidRemoteException(f"Invalid frappe path: {frappe_path}") from e
def log(message, level=0, no_log=False): def log(message, level=0, no_log=False):

View File

@ -280,7 +280,7 @@ def restart_supervisor_processes(bench_path=".", web_workers=False):
sudo = "" sudo = ""
try: try:
supervisor_status = get_cmd_output("supervisorctl status", cwd=bench_path) supervisor_status = get_cmd_output("supervisorctl status", cwd=bench_path)
except Exception as e: except subprocess.CalledProcessError as e:
if e.returncode == 127: if e.returncode == 127:
log("restart failed: Couldn't find supervisorctl in PATH", level=3) log("restart failed: Couldn't find supervisorctl in PATH", level=3)
return return
@ -385,7 +385,6 @@ def update(
from bench.bench import Bench from bench.bench import Bench
from bench.config.common_site_config import update_config from bench.config.common_site_config import update_config
from bench.exceptions import CannotUpdateReleaseBench from bench.exceptions import CannotUpdateReleaseBench
from bench.utils import clear_command_cache
from bench.utils.app import is_version_upgrade from bench.utils.app import is_version_upgrade
from bench.utils.system import backup_all_sites from bench.utils.system import backup_all_sites
@ -394,8 +393,6 @@ def update(
patches.run(bench_path=bench_path) patches.run(bench_path=bench_path)
conf = bench.conf conf = bench.conf
clear_command_cache(bench_path=".")
if conf.get("release_bench"): if conf.get("release_bench"):
raise CannotUpdateReleaseBench("Release bench detected, cannot update!") raise CannotUpdateReleaseBench("Release bench detected, cannot update!")