2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-23 15:08:24 +00:00

One Trace

This commit is contained in:
Pratik Vyas 2015-05-11 20:51:17 +05:30
parent 1b52081da3
commit d79d1af2c5
2 changed files with 16 additions and 6 deletions

View File

@ -14,7 +14,7 @@ from .utils import (build_assets, patch_sites, exec_cmd, update_bench, get_env_c
get_config, update_config, restart_supervisor_processes, put_config, default_config, update_requirements, get_config, update_config, restart_supervisor_processes, put_config, default_config, update_requirements,
backup_all_sites, backup_site, get_sites, prime_wheel_cache, is_root, set_mariadb_host, drop_privileges, backup_all_sites, backup_site, get_sites, prime_wheel_cache, is_root, set_mariadb_host, drop_privileges,
fix_file_perms, fix_prod_setup_perms, set_ssl_certificate, set_ssl_certificate_key, get_cmd_output, post_upgrade, fix_file_perms, fix_prod_setup_perms, set_ssl_certificate, set_ssl_certificate_key, get_cmd_output, post_upgrade,
pre_upgrade) pre_upgrade, PatchError)
from .app import get_app as _get_app from .app import get_app as _get_app
from .app import new_app as _new_app from .app import new_app as _new_app
from .app import pull_all_apps, get_apps, get_current_frappe_version, is_version_upgrade, switch_to_v4, switch_to_master, switch_to_develop from .app import pull_all_apps, get_apps, get_current_frappe_version, is_version_upgrade, switch_to_v4, switch_to_master, switch_to_develop
@ -52,7 +52,10 @@ def cli():
elif len(sys.argv) > 1 and sys.argv[1] in get_apps(): elif len(sys.argv) > 1 and sys.argv[1] in get_apps():
return app_cmd() return app_cmd()
else: else:
bench() try:
bench()
except PatchError:
sys.exit(1)
def cmd_requires_root(): def cmd_requires_root():
if len(sys.argv) > 2 and sys.argv[2] in ('production', 'sudoers'): if len(sys.argv) > 2 and sys.argv[2] in ('production', 'sudoers'):

View File

@ -8,6 +8,10 @@ import json
from distutils.spawn import find_executable from distutils.spawn import find_executable
import pwd, grp import pwd, grp
class PatchError(Exception):
pass
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -112,10 +116,13 @@ def new_site(site, mariadb_root_password=None, admin_password=None, bench='.'):
exec_cmd("{frappe} --use {site}".format(frappe=get_frappe(bench=bench), site=site), cwd=os.path.join(bench, 'sites')) exec_cmd("{frappe} --use {site}".format(frappe=get_frappe(bench=bench), site=site), cwd=os.path.join(bench, 'sites'))
def patch_sites(bench='.'): def patch_sites(bench='.'):
if FRAPPE_VERSION == 4: try:
exec_cmd("{frappe} --latest all".format(frappe=get_frappe(bench=bench)), cwd=os.path.join(bench, 'sites')) if FRAPPE_VERSION == 4:
else: exec_cmd("{frappe} --latest all".format(frappe=get_frappe(bench=bench)), cwd=os.path.join(bench, 'sites'))
run_frappe_cmd('--site', 'all', 'migrate', bench=bench) else:
run_frappe_cmd('--site', 'all', 'migrate', bench=bench)
except subprocess.CalledProcessError:
raise PatchError
def build_assets(bench='.'): def build_assets(bench='.'):
if FRAPPE_VERSION == 4: if FRAPPE_VERSION == 4: