mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
translate _diagnosis_ignore function
This commit is contained in:
parent
5d15c00d92
commit
ab742e55bb
2 changed files with 14 additions and 13 deletions
|
@ -249,6 +249,13 @@
|
|||
"diagnosis_http_timeout": "Timed-out while trying to contact your server from the outside. It appears to be unreachable.<br>1. The most common cause for this issue is that port 80 (and 443) <a href='https://yunohost.org/isp_box_config'>are not correctly forwarded to your server</a>.<br>2. You should also make sure that the service nginx is running<br>3. On more complex setups: make sure that no firewall or reverse-proxy is interfering.",
|
||||
"diagnosis_http_unreachable": "Domain {domain} appears unreachable through HTTP from outside the local network.",
|
||||
"diagnosis_ignored_issues": "(+ {nb_ignored} ignored issue(s))",
|
||||
"diagnosis_ignore_already_filtered": "There is already a diagnosis {category} filter with these criterias)",
|
||||
"diagnosis_ignore_no_filter_found": "(There is no such diagnosis {category} filter with these criterias to remove)",
|
||||
"diagnosis_ignore_filter_added": "Added a {category} diagnosis filter",
|
||||
"diagnosis_ignore_filter_removed": "Removed a {category} diagnosis filter",
|
||||
"diagnosis_ignore_missing_criteria": "You should provide at least one criteria being the diagnosis category to ignore",
|
||||
"diagnosis_ignore_criteria_error": "Criterias should be of the form key=value (e.g. domain=yolo.test)",
|
||||
"diagnosis_ignore_no_issue_found": "No issues was found matching the given criteria.",
|
||||
"diagnosis_ip_broken_dnsresolution": "Domain name resolution seems to be broken for some reason… Is a firewall blocking DNS requests?",
|
||||
"diagnosis_ip_broken_resolvconf": "Domain name resolution seems to be broken on your server, which seems related to <code>/etc/resolv.conf</code> not pointing to <code>127.0.0.1</code>.",
|
||||
"diagnosis_ip_connected_ipv4": "The server is connected to the Internet through IPv4!",
|
||||
|
|
|
@ -263,16 +263,12 @@ def _diagnosis_ignore(add_filter=None, remove_filter=None, list=False):
|
|||
|
||||
# Sanity checks for the provided arguments
|
||||
if len(filter_) == 0:
|
||||
raise YunohostValidationError(
|
||||
"You should provide at least one criteria being the diagnosis category to ignore"
|
||||
)
|
||||
raise YunohostValidationError(m18n.n("diagnosis_ignore_missing_criteria"))
|
||||
category = filter_[0]
|
||||
if category not in all_categories_names:
|
||||
raise YunohostValidationError(f"{category} is not a diagnosis category")
|
||||
if any("=" not in criteria for criteria in filter_[1:]):
|
||||
raise YunohostValidationError(
|
||||
"Criterias should be of the form key=value (e.g. domain=yolo.test)"
|
||||
)
|
||||
raise YunohostValidationError(m18n.n("diagnosis_ignore_criteria_error"))
|
||||
|
||||
# Convert the provided criteria into a nice dict
|
||||
criterias = {c.split("=")[0]: c.split("=")[1] for c in filter_[1:]}
|
||||
|
@ -295,7 +291,7 @@ def _diagnosis_ignore(add_filter=None, remove_filter=None, list=False):
|
|||
issue_matches_criterias(i, criterias)
|
||||
for i in current_issues_for_this_category
|
||||
):
|
||||
raise YunohostError("No issues was found matching the given criteria.")
|
||||
raise YunohostError(m18n.n("diagnosis_ignore_no_issue_found"))
|
||||
|
||||
# Make sure the subdicts/lists exists
|
||||
if "ignore_filters" not in configuration:
|
||||
|
@ -305,13 +301,13 @@ def _diagnosis_ignore(add_filter=None, remove_filter=None, list=False):
|
|||
|
||||
if criterias in configuration["ignore_filters"][category]:
|
||||
logger.warning(
|
||||
f"(There is already a diagnosis {category} filter with these criterias)"
|
||||
m18n.n("diagnosis_ignore_already_filtered", service=category)
|
||||
)
|
||||
return
|
||||
|
||||
configuration["ignore_filters"][category].append(criterias)
|
||||
_diagnosis_write_configuration(configuration)
|
||||
logger.success(f"Added a {category} diagnosis filter")
|
||||
logger.success(m18n.n("diagnosis_ignore_filter_added", service=category))
|
||||
return
|
||||
|
||||
if remove_filter:
|
||||
|
@ -324,14 +320,12 @@ def _diagnosis_ignore(add_filter=None, remove_filter=None, list=False):
|
|||
configuration["ignore_filters"][category] = []
|
||||
|
||||
if criterias not in configuration["ignore_filters"][category]:
|
||||
logger.warning(
|
||||
f"(There is no such diagnosis {category} filter with these criterias to remove)"
|
||||
)
|
||||
logger.warning(m18n.n("diagnosis_ignore_no_filter_found", service=category))
|
||||
return
|
||||
|
||||
configuration["ignore_filters"][category].remove(criterias)
|
||||
_diagnosis_write_configuration(configuration)
|
||||
logger.success(f"Removed a {category} diagnosis filter")
|
||||
logger.success(m18n.n("diagnosis_ignore_filter_removed", service=category))
|
||||
return
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue