Skip to content

Commit

Permalink
feat: Add warning when installing without running server
Browse files Browse the repository at this point in the history
  • Loading branch information
cogk committed Aug 28, 2023
1 parent f47bb49 commit 6e735ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion hrms/hooks.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 6e735ad

Please sign in to comment.