mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix small issues in port diagnoser
This commit is contained in:
parent
f690ff6e1e
commit
6c48c131a8
1 changed files with 7 additions and 6 deletions
|
@ -4,6 +4,7 @@ import os
|
|||
import requests
|
||||
|
||||
from yunohost.diagnosis import Diagnoser
|
||||
from yunohost.utils.error import YunohostError
|
||||
|
||||
|
||||
class PortsDiagnoser(Diagnoser):
|
||||
|
@ -22,8 +23,8 @@ class PortsDiagnoser(Diagnoser):
|
|||
ports = [22, 25, 53, 80, 443, 587, 993, 5222, 5269]
|
||||
|
||||
try:
|
||||
r = requests.post('https://ynhdiagnoser.netlib.re/check-ports', json={'ports': ports}).json()
|
||||
if not "status" in r.keys():
|
||||
r = requests.post('https://ynhdiagnoser.netlib.re/check-ports', json={'ports': ports}, timeout=30).json()
|
||||
if "status" not in r.keys():
|
||||
raise Exception("Bad syntax for response ? Raw json: %s" % str(r))
|
||||
elif r["status"] == "error":
|
||||
if "content" in r.keys():
|
||||
|
@ -37,7 +38,7 @@ class PortsDiagnoser(Diagnoser):
|
|||
|
||||
found_issues = False
|
||||
for port in ports:
|
||||
if r["ports"].get(str(port), None) != True:
|
||||
if r["ports"].get(str(port), None) is not True:
|
||||
found_issues = True
|
||||
yield dict(meta={"port": port},
|
||||
status="ERROR",
|
||||
|
|
Loading…
Add table
Reference in a new issue