diff options
author | onefang | 2019-12-13 03:16:12 +1000 |
---|---|---|
committer | onefang | 2019-12-13 03:16:12 +1000 |
commit | 018259f210c2e8addd76dd24969803a3529a553d (patch) | |
tree | 8c8244c39e65955b3ad56e9935d05374be9dbd22 /apt-panopticommon.lua | |
parent | Comment++ (diff) | |
download | apt-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.lua | 12 |
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 |
4 | APT.rrd = require 'rrd' | 4 | APT.rrd = require 'rrd' |
5 | 5 | ||
6 | APT.protocols = {"ftp", "http", "https", "rsync"} | ||
7 | |||
6 | verbosity = -1 | 8 | verbosity = -1 |
7 | APT.origin = false | 9 | APT.origin = false |
8 | APT.keep = false | 10 | APT.keep = false |
@@ -247,6 +249,13 @@ dumpTableSub = function (table, space) | |||
247 | return r | 249 | return r |
248 | end | 250 | end |
249 | 251 | ||
252 | APT.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 | ||
257 | end | ||
258 | |||
250 | APT.results = {} | 259 | APT.results = {} |
251 | APT.logFile = nil | 260 | APT.logFile = nil |
252 | APT.html = false | 261 | APT.html = false |
@@ -392,7 +401,7 @@ APT.plurals = function(e, w) | |||
392 | end | 401 | end |
393 | 402 | ||
394 | APT.padResults = function(results) | 403 | APT.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 | |||
477 | local status | 486 | local status |
478 | status, APT.now = APT.execute('TZ="GMT" ls -l --time-style="+%s" results/stamp | cut -d " " -f 6-6') | 487 | status, APT.now = APT.execute('TZ="GMT" ls -l --time-style="+%s" results/stamp | cut -d " " -f 6-6') |
479 | APT.now = tonumber(APT.now) | 488 | APT.now = tonumber(APT.now) |
480 | APT.protocols = {'ftp', 'http', 'https', 'rsync'} | ||
481 | APT.tests = {'raw', 'Integrity', 'Protocol', 'Updated', 'URLSanity', 'Speed'} | 489 | APT.tests = {'raw', 'Integrity', 'Protocol', 'Updated', 'URLSanity', 'Speed'} |
482 | local start = 'now-2week' | 490 | local start = 'now-2week' |
483 | local step = '10min' | 491 | local step = '10min' |