aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/apt-panopticommon.lua
diff options
context:
space:
mode:
authoronefang2019-12-13 03:16:12 +1000
committeronefang2019-12-13 03:16:12 +1000
commit018259f210c2e8addd76dd24969803a3529a553d (patch)
tree8c8244c39e65955b3ad56e9935d05374be9dbd22 /apt-panopticommon.lua
parentComment++ (diff)
downloadapt-panopticon-018259f210c2e8addd76dd24969803a3529a553d.zip
apt-panopticon-018259f210c2e8addd76dd24969803a3529a553d.tar.gz
apt-panopticon-018259f210c2e8addd76dd24969803a3529a553d.tar.bz2
apt-panopticon-018259f210c2e8addd76dd24969803a3529a553d.tar.xz
Refactor the protocols table.
Diffstat (limited to 'apt-panopticommon.lua')
-rw-r--r--apt-panopticommon.lua12
1 files changed, 10 insertions, 2 deletions
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 = {}
3-- https://oss.oetiker.ch/rrdtool/prog/rrdlua.en.html 3-- https://oss.oetiker.ch/rrdtool/prog/rrdlua.en.html
4APT.rrd = require 'rrd' 4APT.rrd = require 'rrd'
5 5
6APT.protocols = {"ftp", "http", "https", "rsync"}
7
6verbosity = -1 8verbosity = -1
7APT.origin = false 9APT.origin = false
8APT.keep = false 10APT.keep = false
@@ -247,6 +249,13 @@ dumpTableSub = function (table, space)
247 return r 249 return r
248end 250end
249 251
252APT.search = function(t, s)
253 for i, v in pairs(t) do
254 if v == s then return true end
255 end
256 return false
257end
258
250APT.results = {} 259APT.results = {}
251APT.logFile = nil 260APT.logFile = nil
252APT.html = false 261APT.html = false
@@ -392,7 +401,7 @@ APT.plurals = function(e, w)
392end 401end
393 402
394APT.padResults = function(results) 403APT.padResults = function(results)
395 for k, v in pairs{"ftp", "http", "https", "rsync"} do 404 for k, v in pairs(APT.protocols) do
396 tests = results[v] 405 tests = results[v]
397 if nil == tests then tests = {errors = 0; warnings = 0} end 406 if nil == tests then tests = {errors = 0; warnings = 0} end
398 if nil == tests.Integrity then tests.Integrity = {errors = 0; warnings = 0} end 407 if nil == tests.Integrity then tests.Integrity = {errors = 0; warnings = 0} end
@@ -477,7 +486,6 @@ APT.now = 0
477local status 486local status
478status, APT.now = APT.execute('TZ="GMT" ls -l --time-style="+%s" results/stamp | cut -d " " -f 6-6') 487status, APT.now = APT.execute('TZ="GMT" ls -l --time-style="+%s" results/stamp | cut -d " " -f 6-6')
479APT.now = tonumber(APT.now) 488APT.now = tonumber(APT.now)
480APT.protocols = {'ftp', 'http', 'https', 'rsync'}
481APT.tests = {'raw', 'Integrity', 'Protocol', 'Updated', 'URLSanity', 'Speed'} 489APT.tests = {'raw', 'Integrity', 'Protocol', 'Updated', 'URLSanity', 'Speed'}
482local start = 'now-2week' 490local start = 'now-2week'
483local step = '10min' 491local step = '10min'