aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2019-12-10 18:58:47 +1000
committeronefang2019-12-10 18:58:47 +1000
commit41bf384e6fd80e983a6061801ca9d56a2bb696f5 (patch)
treef9433427310efdf792b8119b535b757695f7c783
parentShow two weeks of speed for the inital graph. (diff)
downloadapt-panopticon-41bf384e6fd80e983a6061801ca9d56a2bb696f5.zip
apt-panopticon-41bf384e6fd80e983a6061801ca9d56a2bb696f5.tar.gz
apt-panopticon-41bf384e6fd80e983a6061801ca9d56a2bb696f5.tar.bz2
apt-panopticon-41bf384e6fd80e983a6061801ca9d56a2bb696f5.tar.xz
Pad out the results tables when loading them.
-rw-r--r--apt-panopticommon.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua
index b38595c..65a50b8 100644
--- a/apt-panopticommon.lua
+++ b/apt-panopticommon.lua
@@ -397,12 +397,27 @@ APT.plurals = function(e, w)
397 return result 397 return result
398end 398end
399 399
400APT.fill = function(results)
401 for k, v in pairs{"ftp", "http", "https", "rsync"} do
402 tests = results[v]
403 if nil == tests then tests = {errors = 0; warnings = 0} end
404 if nil == tests.Integrity then tests.Integrity = {errors = 0; warnings = 0} end
405 if nil == tests.Protocol then tests.Protocol = {errors = 0; warnings = 0} end
406 if nil == tests.Updated then tests.Updated = {errors = 0; warnings = 0} end
407 if nil == tests.URLSanity then tests.URLSanity = {errors = 0; warnings = 0} end
408 results[v] = tests
409 end
410 return results
411end
412
400APT.collate = function(host, ip, results) 413APT.collate = function(host, ip, results)
414 results = APT.fill(results)
401 local f = "results/" .. host .. "_" .. ip .. ".lua" 415 local f = "results/" .. host .. "_" .. ip .. ".lua"
402 local rfile, e = io.open(f, "r") 416 local rfile, e = io.open(f, "r")
403 if nil == rfile then I("opening " .. f .. " file - " .. e) else 417 if nil == rfile then I("opening " .. f .. " file - " .. e) else
404 rfile:close() 418 rfile:close()
405 local rs = loadfile(f)() 419 local rs = loadfile(f)()
420 rs = APT.fill(rs)
406 for k, v in pairs(rs) do 421 for k, v in pairs(rs) do
407 if "table" == type(v) then 422 if "table" == type(v) then
408 if ("speed" == k) and (nil ~= results.speed) then 423 if ("speed" == k) and (nil ~= results.speed) then
@@ -538,6 +553,7 @@ end
538APT.doRRD = function(l, k, v) 553APT.doRRD = function(l, k, v)
539 if APT.checkFile(l .. "/" .. k .. ".lua") then 554 if APT.checkFile(l .. "/" .. k .. ".lua") then
540 local results = loadfile(l .. "/" .. k .. ".lua")() 555 local results = loadfile(l .. "/" .. k .. ".lua")()
556 results = APT.fill(results)
541 APT.createRRD(k) 557 APT.createRRD(k)
542 APT.updateRRD(results, k) 558 APT.updateRRD(results, k)
543 if til ~= v then 559 if til ~= v then