Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add warning when installing without running server #825

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion hrms/hooks.py
Expand Up @@ -84,7 +84,7 @@
# Installation
# ------------

# before_install = "hrms.install.before_install"
before_install = "hrms.install.before_install"
after_install = "hrms.install.after_install"
after_migrate = "hrms.setup.update_select_perm_after_install"

Expand Down
16 changes: 16 additions & 0 deletions hrms/install.py
Expand Up @@ -3,6 +3,22 @@
from hrms.setup import after_install as setup


def before_install():
from frappe.utils.connections import check_connection

service_status = check_connection(redis_services=["redis_cache"])
are_services_running = all(service_status.values())

if not are_services_running:
for service in service_status:
if not service_status.get(service, True):
click.secho(f"Service {service} is not running.", fg="red")

click.secho("Please ensure that the server is running before installing HRMS.", fg="red")
click.secho("See: https://github.com/frappe/hrms/issues/369#issuecomment-1463632514", fg="red")
raise click.Abort()


def after_install():
try:
print("Setting up Frappe HR...")
Expand Down