fix: don't allow uninstalling frappe...

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2024-08-30 18:04:32 +05:30
parent 73610fed57
commit 30f5669489
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -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")