diff options
Diffstat (limited to '')
-rwxr-xr-x | apt-panopticon-report-email.lua | 36 |
1 files changed, 27 insertions, 9 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" .. |