diff options
author | onefang | 2019-11-13 01:35:44 +1000 |
---|---|---|
committer | onefang | 2019-11-13 01:35:44 +1000 |
commit | 0ca88dc140a504f123505438ead598d4e5f02025 (patch) | |
tree | dc8d4c0772f22debfbe420642fd8d44c8612a595 | |
parent | Rewrite execute(), and also write a fork(). Now execute() properly returns t... (diff) | |
download | apt-panopticon-0ca88dc140a504f123505438ead598d4e5f02025.zip apt-panopticon-0ca88dc140a504f123505438ead598d4e5f02025.tar.gz apt-panopticon-0ca88dc140a504f123505438ead598d4e5f02025.tar.bz2 apt-panopticon-0ca88dc140a504f123505438ead598d4e5f02025.tar.xz |
Make the email and web reports similar, reporting the same tests.
-rwxr-xr-x | apt-panopticon-report-email.lua | 36 | ||||
-rwxr-xr-x | 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 | |||
83 | local faulty = "" | 83 | local faulty = "" |
84 | local status = function(host, results, typ) | 84 | local status = function(host, results, typ) |
85 | local result = "" | 85 | local result = "" |
86 | local e = results[typ].errors | 86 | local e = 0 |
87 | local w = results[typ].warnings | 87 | local w = 0 |
88 | for i, u in pairs(results[typ]) do | 88 | if nil ~= results[typ] then |
89 | if "table" == type(u) then | 89 | e = results[typ].errors |
90 | e = e + u.errors | 90 | w = results[typ].warnings |
91 | w = w + u.warnings | 91 | for k, v in pairs(results[typ]) do |
92 | if "table" == type(v) then | ||
93 | e = e + v.errors | ||
94 | w = w + v.warnings | ||
95 | end | ||
96 | end | ||
97 | else | ||
98 | for k, v in pairs(results) do | ||
99 | if "table" == type(v) then | ||
100 | for i, u in pairs(v) do | ||
101 | if "table" == type(u) then | ||
102 | if typ == i then | ||
103 | e = e + u.errors | ||
104 | w = w + u.warnings | ||
105 | end | ||
106 | end | ||
107 | end | ||
108 | end | ||
92 | end | 109 | end |
93 | end | 110 | end |
94 | 111 | ||
@@ -146,7 +163,6 @@ local collate = function(host, ip, results) | |||
146 | return results | 163 | return results |
147 | end | 164 | end |
148 | 165 | ||
149 | |||
150 | local mirrors = loadfile("results/mirrors.lua")() | 166 | local mirrors = loadfile("results/mirrors.lua")() |
151 | 167 | ||
152 | local file, e = io.open("results/Report-email.txt", "w+") | 168 | local file, e = io.open("results/Report-email.txt", "w+") |
@@ -173,9 +189,11 @@ if nil == file then C("opening mirrors file - " .. e) else | |||
173 | local http = status(k, results, "http") | 189 | local http = status(k, results, "http") |
174 | local https = status(k, results, "https") | 190 | local https = status(k, results, "https") |
175 | local dns = "[skip]" | 191 | local dns = "[skip]" |
176 | local updated = "[skip]" | 192 | local protocol = status(k, results, "Protocol") |
193 | local sanity = "[skip]" | ||
177 | local integrity = "[skip]" | 194 | local integrity = "[skip]" |
178 | file:write(" http: " .. http .. " https: " .. https .. " DNS-RR: " .. dns .. " Updated: " .. updated .. " Integrity: " .. integrity .. "\n") | 195 | local updated = "[skip]" |
196 | file:write(" http: " .. http .. " https: " .. https .. " DNS-RR: " .. dns .. " Protocol: " .. protocol .. " URL-sanity: " .. sanity .. " Integrity: " .. integrity .. " Updated: " .. updated .. "\n") | ||
179 | end | 197 | end |
180 | file:write( "==== faulty mirrors: ====\n\n" .. faulty) | 198 | file:write( "==== faulty mirrors: ====\n\n" .. faulty) |
181 | file:write( "---- END MIRROR-STATUS ----\n\n" .. | 199 | 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) | |||
109 | end | 109 | end |
110 | end | 110 | end |
111 | 111 | ||
112 | if 0 < e then result = e .. " <font color='red'><b>error</b></font>" end | 112 | if 0 < e then result = e .. " <font color='red'><b>errors</b></font>" end |
113 | if 1 == e then result = e .. " <font color='red'><b>error</b></font>" end | 113 | if 1 == e then result = e .. " <font color='red'><b>error</b></font>" end |
114 | if 0 < w then | 114 | if 0 < w then |
115 | if 0 < e then result = result .. ", " end | 115 | if 0 < e then result = result .. ", " end |
@@ -163,7 +163,6 @@ local collate = function(host, ip, results) | |||
163 | return results | 163 | return results |
164 | end | 164 | end |
165 | 165 | ||
166 | |||
167 | local mirrors = loadfile("results/mirrors.lua")() | 166 | local mirrors = loadfile("results/mirrors.lua")() |
168 | 167 | ||
169 | local file, e = io.open("results/Report-web.html", "w+") | 168 | local file, e = io.open("results/Report-web.html", "w+") |
@@ -184,14 +183,14 @@ if nil == file then C("opening mirrors file - " .. e) else | |||
184 | results = collate(k, i, results) | 183 | results = collate(k, i, results) |
185 | end | 184 | end |
186 | end | 185 | end |
187 | -- local http = status(k, results, "http") | 186 | local http = status(k, results, "http") |
188 | -- local https = status(k, results, "https") | 187 | local https = status(k, results, "https") |
189 | local dns = "[<font color='yellow'><b>skip</b></font>]" | 188 | local dns = "[<font color='yellow'><b>skip</b></font>]" |
189 | local protocol = status(k, results, "Protocol") | ||
190 | local sanity = "[<font color='yellow'><b>skip</b></font>]" | ||
190 | local integrity = "[<font color='yellow'><b>skip</b></font>]" | 191 | local integrity = "[<font color='yellow'><b>skip</b></font>]" |
191 | local protocol = status(k, results, "Protocol") | ||
192 | local sanity = "[<font color='yellow'><b>skip</b></font>]" | ||
193 | local updated = "[<font color='yellow'><b>skip</b></font>]" | 192 | local updated = "[<font color='yellow'><b>skip</b></font>]" |
194 | file:write(" DNS-RR: " .. dns .. " Integrity: " .. integrity .. " Protocol: " .. protocol .. " URL-sanity: " .. sanity .. " Updated: " .. updated .. "\n<br>\n") | 193 | file:write(" http: " .. http .. " https: " .. https .. " DNS-RR: " .. dns .. " Protocol: " .. protocol .. " URL-sanity: " .. sanity .. " Integrity: " .. integrity .. " Updated: " .. updated .. "\n<br>\n") |
195 | end | 194 | end |
196 | file:write( "==== faulty mirrors: ====<br>\n<br>\n" .. faulty) | 195 | file:write( "==== faulty mirrors: ====<br>\n<br>\n" .. faulty) |
197 | file:write( "\n<br>\nLast Failure: NOT WRITTEN YET<br>\n<br>") | 196 | file:write( "\n<br>\nLast Failure: NOT WRITTEN YET<br>\n<br>") |