From 018259f210c2e8addd76dd24969803a3529a553d Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 13 Dec 2019 03:16:12 +1000 Subject: Refactor the protocols table. --- apt-panopticommon.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'apt-panopticommon.lua') diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index 182d90c..22354f3 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua @@ -3,6 +3,8 @@ local APT = {} -- https://oss.oetiker.ch/rrdtool/prog/rrdlua.en.html APT.rrd = require 'rrd' +APT.protocols = {"ftp", "http", "https", "rsync"} + verbosity = -1 APT.origin = false APT.keep = false @@ -247,6 +249,13 @@ dumpTableSub = function (table, space) return r end +APT.search = function(t, s) + for i, v in pairs(t) do + if v == s then return true end + end + return false +end + APT.results = {} APT.logFile = nil APT.html = false @@ -392,7 +401,7 @@ APT.plurals = function(e, w) end APT.padResults = function(results) - for k, v in pairs{"ftp", "http", "https", "rsync"} do + for k, v in pairs(APT.protocols) do tests = results[v] if nil == tests then tests = {errors = 0; warnings = 0} end if nil == tests.Integrity then tests.Integrity = {errors = 0; warnings = 0} end @@ -477,7 +486,6 @@ APT.now = 0 local status status, APT.now = APT.execute('TZ="GMT" ls -l --time-style="+%s" results/stamp | cut -d " " -f 6-6') APT.now = tonumber(APT.now) -APT.protocols = {'ftp', 'http', 'https', 'rsync'} APT.tests = {'raw', 'Integrity', 'Protocol', 'Updated', 'URLSanity', 'Speed'} local start = 'now-2week' local step = '10min' -- cgit v1.1