aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2019-12-13 03:16:12 +1000
committeronefang2019-12-13 03:16:12 +1000
commit018259f210c2e8addd76dd24969803a3529a553d (patch)
tree8c8244c39e65955b3ad56e9935d05374be9dbd22
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 '')
-rw-r--r--apt-panopticommon.lua12
-rwxr-xr-xapt-panopticon-report-email-web.lua3
-rwxr-xr-xapt-panopticon.lua3
3 files changed, 14 insertions, 4 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'
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index 382b14d..94f0417 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -49,7 +49,8 @@ local status = function(host, results, typ)
49 local w = 0 49 local w = 0
50 local s = nil ~= APT.mirrors[host].Protocols[typ] 50 local s = nil ~= APT.mirrors[host].Protocols[typ]
51 local to = results.timeout 51 local to = results.timeout
52 if ('http' ~= typ) and ('https' ~= typ) and ('ftp' ~= typ) and ('rsync' ~= typ) then s = true end 52-- if ('http' ~= typ) and ('https' ~= typ) and ('ftp' ~= typ) and ('rsync' ~= typ) then s = true end
53 if not APT.search(APT.protocols, typ) then s = true end
53 if nil ~= results[typ] then 54 if nil ~= results[typ] then
54 e = results[typ].errors 55 e = results[typ].errors
55 w = results[typ].warnings 56 w = results[typ].warnings
diff --git a/apt-panopticon.lua b/apt-panopticon.lua
index 62acbf25..8b02626 100755
--- a/apt-panopticon.lua
+++ b/apt-panopticon.lua
@@ -606,7 +606,8 @@ local getMirrors = function ()
606 elseif "Protocols" == t then 606 elseif "Protocols" == t then
607 local prot = {} 607 local prot = {}
608 for w in d:gmatch("(%w+)") do 608 for w in d:gmatch("(%w+)") do
609 prot[w] = true; 609-- prot[w] = true;
610 if APT.search(APT.protocols, w:lower()) then prot[w] = true end
610 end 611 end
611 m[t] = prot 612 m[t] = prot
612 elseif "Active" == t and nil == d:sub(1, 3):find("yes", 1, true) then 613 elseif "Active" == t and nil == d:sub(1, 3):find("yes", 1, true) then