From 0ca88dc140a504f123505438ead598d4e5f02025 Mon Sep 17 00:00:00 2001
From: onefang
Date: Wed, 13 Nov 2019 01:35:44 +1000
Subject: Make the email and web reports similar, reporting the same tests.
---
apt-panopticon-report-email.lua | 36 +++++++++++++++++++++++++++---------
apt-panopticon-report-web.lua | 13 ++++++-------
2 files changed, 33 insertions(+), 16 deletions(-)
diff --git a/apt-panopticon-report-email.lua b/apt-panopticon-report-email.lua
index 5651f71..e157dc1 100755
--- a/apt-panopticon-report-email.lua
+++ b/apt-panopticon-report-email.lua
@@ -83,12 +83,29 @@ local C = function(s) log(-1, "CRITICAL", s) end
local faulty = ""
local status = function(host, results, typ)
local result = ""
- local e = results[typ].errors
- local w = results[typ].warnings
- for i, u in pairs(results[typ]) do
- if "table" == type(u) then
- e = e + u.errors
- w = w + u.warnings
+ local e = 0
+ local w = 0
+ if nil ~= results[typ] then
+ e = results[typ].errors
+ w = results[typ].warnings
+ for k, v in pairs(results[typ]) do
+ if "table" == type(v) then
+ e = e + v.errors
+ w = w + v.warnings
+ end
+ end
+ else
+ for k, v in pairs(results) do
+ if "table" == type(v) then
+ for i, u in pairs(v) do
+ if "table" == type(u) then
+ if typ == i then
+ e = e + u.errors
+ w = w + u.warnings
+ end
+ end
+ end
+ end
end
end
@@ -146,7 +163,6 @@ local collate = function(host, ip, results)
return results
end
-
local mirrors = loadfile("results/mirrors.lua")()
local file, e = io.open("results/Report-email.txt", "w+")
@@ -173,9 +189,11 @@ if nil == file then C("opening mirrors file - " .. e) else
local http = status(k, results, "http")
local https = status(k, results, "https")
local dns = "[skip]"
- local updated = "[skip]"
+ local protocol = status(k, results, "Protocol")
+ local sanity = "[skip]"
local integrity = "[skip]"
- file:write(" http: " .. http .. " https: " .. https .. " DNS-RR: " .. dns .. " Updated: " .. updated .. " Integrity: " .. integrity .. "\n")
+ local updated = "[skip]"
+ file:write(" http: " .. http .. " https: " .. https .. " DNS-RR: " .. dns .. " Protocol: " .. protocol .. " URL-sanity: " .. sanity .. " Integrity: " .. integrity .. " Updated: " .. updated .. "\n")
end
file:write( "==== faulty mirrors: ====\n\n" .. faulty)
file:write( "---- END MIRROR-STATUS ----\n\n" ..
diff --git a/apt-panopticon-report-web.lua b/apt-panopticon-report-web.lua
index ca7ce4b..163d50f 100755
--- a/apt-panopticon-report-web.lua
+++ b/apt-panopticon-report-web.lua
@@ -109,7 +109,7 @@ local status = function(host, results, typ)
end
end
- if 0 < e then result = e .. " error" end
+ if 0 < e then result = e .. " errors" end
if 1 == e then result = e .. " error" end
if 0 < w then
if 0 < e then result = result .. ", " end
@@ -163,7 +163,6 @@ local collate = function(host, ip, results)
return results
end
-
local mirrors = loadfile("results/mirrors.lua")()
local file, e = io.open("results/Report-web.html", "w+")
@@ -184,14 +183,14 @@ if nil == file then C("opening mirrors file - " .. e) else
results = collate(k, i, results)
end
end
--- local http = status(k, results, "http")
--- local https = status(k, results, "https")
+ local http = status(k, results, "http")
+ local https = status(k, results, "https")
local dns = "[skip]"
+ local protocol = status(k, results, "Protocol")
+ local sanity = "[skip]"
local integrity = "[skip]"
- local protocol = status(k, results, "Protocol")
- local sanity = "[skip]"
local updated = "[skip]"
- file:write(" DNS-RR: " .. dns .. " Integrity: " .. integrity .. " Protocol: " .. protocol .. " URL-sanity: " .. sanity .. " Updated: " .. updated .. "\n
\n")
+ file:write(" http: " .. http .. " https: " .. https .. " DNS-RR: " .. dns .. " Protocol: " .. protocol .. " URL-sanity: " .. sanity .. " Integrity: " .. integrity .. " Updated: " .. updated .. "\n
\n")
end
file:write( "==== faulty mirrors: ====
\n
\n" .. faulty)
file:write( "\n
\nLast Failure: NOT WRITTEN YET
\n
")
--
cgit v1.1