From c05d4ff4d1c5f5eb61b92fb7fff8f667aa0c9b40 Mon Sep 17 00:00:00 2001
From: onefang
Date: Mon, 20 Jul 2020 22:34:32 +1000
Subject: If a thing is untested, mark it as so.
---
apt-panopticon-report-email-web.lua | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
(limited to 'apt-panopticon-report-email-web.lua')
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index a9852c1..b21ba8a 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -51,15 +51,18 @@ local status = function(hosts, host, results, typ)
local e = 0
local w = 0
local t = 0
+ local d = 0
local s = nil ~= hosts[host].Protocols[typ]
local to = results.timeout
if not APT.search(APT.protocols, typ) then s = true end
if nil ~= results[typ] then
+ d = results[typ].tested
e = results[typ].errors
w = results[typ].warnings
t = results[typ].timeouts
for k, v in pairs(results[typ]) do
if ("table" == type(v)) and ('redirects' ~= k) then
+ if 0 <= v.tested then d = d + v.tested else to = true end
if 0 <= v.errors then e = e + v.errors else to = true end
if 0 <= v.warnings then w = w + v.warnings else to = true end
if 0 <= v.timeouts then t = t + v.timeouts else to = true end
@@ -71,6 +74,7 @@ local status = function(hosts, host, results, typ)
for i, u in pairs(v) do
if "table" == type(u) then
if typ == i then
+ if 0 <= u.tested then d = d + u.tested end
if 0 <= u.errors then e = e + u.errors end
if 0 <= u.warnings then w = w + u.warnings end
if 0 <= u.timeouts then t = t + u.timeouts end
@@ -111,7 +115,7 @@ local status = function(hosts, host, results, typ)
else
faulty = faulty .. host .. " (" .. typ .. ")\n"
end
- else
+ elseif 0 < d then
result = "OK"
if not s then result = result .. "*" end
if APT.html then
@@ -121,6 +125,16 @@ local status = function(hosts, host, results, typ)
result = "OK*"
end
end
+ else
+ result = "untested"
+ if not s then result = result .. "*" end
+ if APT.html then
+ if s then
+ result = "untested"
+ else
+ result = "untested*"
+ end
+ end
end
return result .. APT.plurals(e, w, t)
end
--
cgit v1.1