split '/diagnosis/ignore' and '/diagnosis/ungignore'

This commit is contained in:
axolotle 2021-03-22 23:41:06 +01:00
parent 113d9f5a8b
commit ff772cd294
2 changed files with 19 additions and 7 deletions

View file

@ -1795,17 +1795,21 @@ diagnosis:
ignore:
action_help: Configure some diagnosis results to be ignored and therefore not considered as actual issues
api: POST /diagnosis/ignore
api: PUT /diagnosis/ignore
arguments:
--add-filter:
--filter:
help: "Add a filter. The first element should be a diagnosis category, and other criterias can be provided using the infos from the 'meta' sections in 'yunohost diagnosis show'. For example: 'dnsrecords domain=yolo.test category=xmpp'"
nargs: "*"
metavar: CRITERIA
--remove-filter:
help: Remove a filter (it should be an existing filter as listed with --list)
nargs: "*"
metavar: CRITERIA
--list:
help: List active ignore filters
action: store_true
unignore:
action_help: Configure some diagnosis results to be unignored and therefore considered as actual issues
api: PUT /diagnosis/unignore
arguments:
--filter:
help: Remove a filter (it should be an existing filter as listed with --list)
nargs: "*"
metavar: CRITERIA

View file

@ -221,7 +221,15 @@ def diagnosis_run(
logger.warning(m18n.n("diagnosis_display_tip"))
def diagnosis_ignore(add_filter=None, remove_filter=None, list=False):
def diagnosis_ignore(filter, list=False):
return _diagnosis_ignore(add_filter=filter, list=list)
def diagnosis_unignore(filter):
return _diagnosis_ignore(remove_filter=filter)
def _diagnosis_ignore(add_filter=None, remove_filter=None, list=False):
"""
This action is meant for the admin to ignore issues reported by the
diagnosis system if they are known and understood by the admin. For