mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Only report an INFO is domain ain't accessible in IPv6 and there's in fact no AAAA record set yet
This commit is contained in:
parent
4e64e2ccfd
commit
be0da3b9dc
1 changed files with 34 additions and 6 deletions
|
@ -17,7 +17,7 @@ class WebDiagnoser(Diagnoser):
|
||||||
|
|
||||||
id_ = os.path.splitext(os.path.basename(__file__))[0].split("-")[1]
|
id_ = os.path.splitext(os.path.basename(__file__))[0].split("-")[1]
|
||||||
cache_duration = 3600
|
cache_duration = 3600
|
||||||
dependencies = ["ip"]
|
dependencies = ["ip", "dnsrecords"]
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
|
@ -118,11 +118,39 @@ class WebDiagnoser(Diagnoser):
|
||||||
else:
|
else:
|
||||||
passed, failed = (4, 6) if results[4][domain]["status"] == "ok" else (6, 4)
|
passed, failed = (4, 6) if results[4][domain]["status"] == "ok" else (6, 4)
|
||||||
detail = results[failed][domain]["status"]
|
detail = results[failed][domain]["status"]
|
||||||
|
|
||||||
|
# Failing in ipv4 is critical.
|
||||||
|
# If we failed in IPv6 but there's in fact no AAAA record
|
||||||
|
# It's an acceptable situation and we shall not report an
|
||||||
|
# error
|
||||||
|
def ipv6_is_important_for_this_domain():
|
||||||
|
dnsrecords = Diagnoser.get_cached_report("dnsrecords", item={"domain": domain, "category": "basic"}) or {}
|
||||||
|
AAAA_status = dnsrecords.get("data", {}).get("AAAA:@")
|
||||||
|
|
||||||
|
return AAAA_status in ["OK", "WRONG"]
|
||||||
|
|
||||||
|
if failed == 4 or ipv6_is_important_for_this_domain():
|
||||||
yield dict(meta={"domain": domain},
|
yield dict(meta={"domain": domain},
|
||||||
data={"passed": passed, "failed": failed},
|
data={"passed": passed, "failed": failed},
|
||||||
status="ERROR",
|
status="ERROR",
|
||||||
summary="diagnosis_http_partially_unreachable",
|
summary="diagnosis_http_partially_unreachable",
|
||||||
details=[detail.replace("error_http_check", "diagnosis_http")])
|
details=[detail.replace("error_http_check", "diagnosis_http")])
|
||||||
|
# So otherwise we report a success (note that this info is
|
||||||
|
# later used to know that ACME challenge is doable)
|
||||||
|
#
|
||||||
|
# And in addition we report an info about the failure in IPv6
|
||||||
|
# *with a different meta* (important to avoid conflicts when
|
||||||
|
# fetching the other info...)
|
||||||
|
else:
|
||||||
|
self.do_hairpinning_test = True
|
||||||
|
yield dict(meta={"domain": domain},
|
||||||
|
status="SUCCESS",
|
||||||
|
summary="diagnosis_http_ok")
|
||||||
|
yield dict(meta={"test": "ipv6", "domain": domain},
|
||||||
|
data={"passed": passed, "failed": failed},
|
||||||
|
status="INFO",
|
||||||
|
summary="diagnosis_http_partially_unreachable",
|
||||||
|
details=[detail.replace("error_http_check", "diagnosis_http")])
|
||||||
|
|
||||||
|
|
||||||
def main(args, env, loggers):
|
def main(args, env, loggers):
|
||||||
|
|
Loading…
Add table
Reference in a new issue