From 526a3a25c93388bf93061f6f9270ec5d3ace09fa Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 26 Mar 2020 19:38:34 +0100 Subject: [PATCH] Remote diagnoser also returns code 400 or 418 when port / http ain't correctly exposed --- data/hooks/diagnosis/14-ports.py | 2 +- data/hooks/diagnosis/21-web.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/hooks/diagnosis/14-ports.py b/data/hooks/diagnosis/14-ports.py index a0c0fa03f..7730ddb57 100644 --- a/data/hooks/diagnosis/14-ports.py +++ b/data/hooks/diagnosis/14-ports.py @@ -28,7 +28,7 @@ class PortsDiagnoser(Diagnoser): try: r = requests.post('https://diagnosis.yunohost.org/check-ports', json={'ports': ports.keys()}, timeout=30) - if r.status_code != 200: + if r.status_code not in [200, 400, 418]: raise Exception("Bad response from the server https://diagnosis.yunohost.org/check-ports : %s - %s" % (str(r.status_code), r.content)) r = r.json() if "status" not in r.keys(): diff --git a/data/hooks/diagnosis/21-web.py b/data/hooks/diagnosis/21-web.py index 1f6547c8c..2a3afba88 100644 --- a/data/hooks/diagnosis/21-web.py +++ b/data/hooks/diagnosis/21-web.py @@ -29,7 +29,7 @@ class WebDiagnoser(Diagnoser): try: r = requests.post('https://diagnosis.yunohost.org/check-http', json={'domain': domain, "nonce": nonce}, timeout=30) - if r.status_code != 200: + if r.status_code not in [200, 400, 418]: raise Exception("Bad response from the server https://diagnosis.yunohost.org/check-http : %s - %s" % (str(r.status_code), r.content)) r = r.json() if "status" not in r.keys():