Hmf I dunno let's have this weird option if we really want to have a special case for first-run ...

This commit is contained in:
Alexandre Aubin 2020-04-18 02:54:16 +02:00
parent 749ca54a34
commit 301ced9d6e
2 changed files with 11 additions and 5 deletions

View file

@ -1686,6 +1686,9 @@ diagnosis:
--force:
help: Ignore the cached report even if it is still 'fresh'
action: store_true
--except-if-never-ran-yet:
help: Don't run anything if diagnosis never ran yet ... (this is meant to be used by the webadmin)
action: store_true
ignore:
action_help: Configure some diagnosis results to be ignored and therefore not considered as actual issues

View file

@ -69,6 +69,10 @@ def diagnosis_get(category, item):
def diagnosis_show(categories=[], issues=False, full=False, share=False):
if not os.path.exists(DIAGNOSIS_CACHE):
logger.warning(m18n.n("diagnosis_never_ran_yet"))
return
# Get all the categories
all_categories = _list_diagnosis_categories()
all_categories_names = [category for category, _ in all_categories]
@ -81,10 +85,6 @@ def diagnosis_show(categories=[], issues=False, full=False, share=False):
if unknown_categories:
raise YunohostError('diagnosis_unknown_categories', categories=", ".join(unknown_categories))
if not os.path.exists(DIAGNOSIS_CACHE):
logger.warning(m18n.n("diagnosis_never_ran_yet"))
return
# Fetch all reports
all_reports = []
for category in categories:
@ -146,7 +146,10 @@ def _dump_human_readable_reports(reports):
return(output)
def diagnosis_run(categories=[], force=False):
def diagnosis_run(categories=[], force=False, except_if_never_ran_yet=False):
if except_if_never_ran_yet and not os.path.exists(DIAGNOSIS_CACHE):
return
# Get all the categories
all_categories = _list_diagnosis_categories()