mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Implement detail mechanism for DNS category
This commit is contained in:
parent
2b2ff08f08
commit
3200fef39c
2 changed files with 15 additions and 5 deletions
|
@ -54,8 +54,10 @@ class DNSDiagnoser(Diagnoser):
|
|||
current_value = self.get_current_record(domain, r["name"], r["type"]) or "None"
|
||||
expected_value = r["value"] if r["value"] != "@" else domain+"."
|
||||
|
||||
if current_value != expected_value:
|
||||
discrepancies.append((r, expected_value, current_value))
|
||||
if current_value == "None":
|
||||
discrepancies.append(("diagnosis_dns_missing_record", (r["type"], r["name"], expected_value)))
|
||||
elif current_value != expected_value:
|
||||
discrepancies.append(("diagnosis_dns_discrepancy", (r["type"], r["name"], expected_value, current_value)))
|
||||
|
||||
if discrepancies:
|
||||
if category == "basic" or is_main_domain:
|
||||
|
@ -66,11 +68,16 @@ class DNSDiagnoser(Diagnoser):
|
|||
else:
|
||||
level = "SUCCESS"
|
||||
report = ("SUCCESS", "diagnosis_dns_good_conf", {"domain": domain, "category": category})
|
||||
details = None
|
||||
|
||||
# FIXME : add management of details of what's wrong if there are discrepancies
|
||||
yield dict(meta = {"domain": domain, "category": category},
|
||||
result = level, report = report )
|
||||
output = dict(meta = {"domain": domain, "category": category},
|
||||
result = level,
|
||||
report = report )
|
||||
|
||||
if discrepancies:
|
||||
output["details"] = discrepancies
|
||||
|
||||
yield output
|
||||
|
||||
|
||||
def get_current_record(self, domain, name, type_):
|
||||
|
|
|
@ -73,6 +73,9 @@ def diagnosis_show(categories=[], full=False):
|
|||
type_, message_key, message_args = r["report"]
|
||||
r["report"] = (type_, m18n.n(message_key, **message_args))
|
||||
|
||||
if "details" in r:
|
||||
r["details"] = [ m18n.n(key, *values) for key, values in r["details"] ]
|
||||
|
||||
return {"reports": all_reports}
|
||||
|
||||
def diagnosis_run(categories=[], force=False, args=None):
|
||||
|
|
Loading…
Add table
Reference in a new issue