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"
|
current_value = self.get_current_record(domain, r["name"], r["type"]) or "None"
|
||||||
expected_value = r["value"] if r["value"] != "@" else domain+"."
|
expected_value = r["value"] if r["value"] != "@" else domain+"."
|
||||||
|
|
||||||
if current_value != expected_value:
|
if current_value == "None":
|
||||||
discrepancies.append((r, expected_value, current_value))
|
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 discrepancies:
|
||||||
if category == "basic" or is_main_domain:
|
if category == "basic" or is_main_domain:
|
||||||
|
@ -66,11 +68,16 @@ class DNSDiagnoser(Diagnoser):
|
||||||
else:
|
else:
|
||||||
level = "SUCCESS"
|
level = "SUCCESS"
|
||||||
report = ("SUCCESS", "diagnosis_dns_good_conf", {"domain": domain, "category": category})
|
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
|
output = dict(meta = {"domain": domain, "category": category},
|
||||||
yield dict(meta = {"domain": domain, "category": category},
|
result = level,
|
||||||
result = level, report = report )
|
report = report )
|
||||||
|
|
||||||
|
if discrepancies:
|
||||||
|
output["details"] = discrepancies
|
||||||
|
|
||||||
|
yield output
|
||||||
|
|
||||||
|
|
||||||
def get_current_record(self, domain, name, type_):
|
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"]
|
type_, message_key, message_args = r["report"]
|
||||||
r["report"] = (type_, m18n.n(message_key, **message_args))
|
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}
|
return {"reports": all_reports}
|
||||||
|
|
||||||
def diagnosis_run(categories=[], force=False, args=None):
|
def diagnosis_run(categories=[], force=False, args=None):
|
||||||
|
|
Loading…
Add table
Reference in a new issue