From cfa7afb08cb467b2c06a3cc366c7f760ba4afff1 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Wed, 10 Jun 2020 11:32:44 +0530 Subject: [PATCH] fix(doctor): update broken command behaviour --- frappe/commands/__init__.py | 6 ++++-- frappe/commands/scheduler.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frappe/commands/__init__.py b/frappe/commands/__init__.py index 42f4440547..b7294fff77 100644 --- a/frappe/commands/__init__.py +++ b/frappe/commands/__init__.py @@ -43,12 +43,14 @@ def pass_context(f): return click.pass_context(_func) -def get_site(context): +def get_site(context, raise_err=True): try: site = context.sites[0] return site except (IndexError, TypeError): - raise frappe.SiteNotSpecifiedError + if raise_err: + raise frappe.SiteNotSpecifiedError + return None def popen(command, *args, **kwargs): output = kwargs.get('output', True) diff --git a/frappe/commands/scheduler.py b/frappe/commands/scheduler.py index 511fac6e0d..bd9c9d2cb0 100755 --- a/frappe/commands/scheduler.py +++ b/frappe/commands/scheduler.py @@ -126,7 +126,7 @@ def doctor(context, site=None): "Get diagnostic info about background workers" from frappe.utils.doctor import doctor as _doctor if not site: - site = get_site(context) + site = get_site(context, raise_err=False) return _doctor(site=site) @click.command('show-pending-jobs')