diff --git a/frappe/commands/site.py b/frappe/commands/site.py index 3c2c3950d1..d11b83902e 100644 --- a/frappe/commands/site.py +++ b/frappe/commands/site.py @@ -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")