fix: don't allow uninstalling frappe...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
73610fed57
commit
30f5669489
1 changed files with 14 additions and 0 deletions
|
|
@ -880,6 +880,7 @@ def backup(
|
|||
@pass_context
|
||||
def remove_from_installed_apps(context, app):
|
||||
"Remove app from site's installed-apps list"
|
||||
ensure_app_not_frappe(app)
|
||||
from frappe.installer import remove_from_installed_apps
|
||||
|
||||
for site in context.sites:
|
||||
|
|
@ -908,6 +909,7 @@ def remove_from_installed_apps(context, app):
|
|||
@pass_context
|
||||
def uninstall(context, app, dry_run, yes, no_backup, force):
|
||||
"Remove app and linked modules from site"
|
||||
ensure_app_not_frappe(app)
|
||||
from frappe.installer import remove_app
|
||||
from frappe.utils.synchronization import filelock
|
||||
|
||||
|
|
@ -1493,6 +1495,18 @@ def add_new_user(
|
|||
update_password(user=user.name, pwd=password)
|
||||
|
||||
|
||||
def ensure_app_not_frappe(app: str) -> None:
|
||||
"""
|
||||
Ensure that the app name passed is not 'frappe'
|
||||
|
||||
:param app: Name of the app
|
||||
:return: Nothing
|
||||
"""
|
||||
if app == "frappe":
|
||||
click.secho("You cannot remove or uninstall the app `frappe`", fg="red")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@click.command("bypass-patch")
|
||||
@click.argument("patch_name")
|
||||
@click.option("--yes", "-y", is_flag=True, default=False, help="Pass --yes to skip confirmation")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue