Fix many missing requires.

This commit is contained in:
Nicolo Maio 2024-02-20 10:14:40 +01:00
parent e243f7c826
commit 83634d06e1
6 changed files with 9 additions and 4 deletions

View file

@ -20,6 +20,7 @@ local http_lint = {}
local json = require "dkjson"
local tracker = require "tracker"
local locales_utils = require "locales_utils"
require "ntop_utils"
-- #################################################################
@ -93,7 +94,7 @@ local function validateListOfType(l, validate_callback, separator)
local items = split(l, separator)
for _, item in pairs(items) do
if item ~= "" then
if item and item ~= "" then
if not validate_callback(item) then
return false
end

View file

@ -162,11 +162,11 @@ function hostkey2hostinfo(key)
local host = {}
local info = split(key,"@")
if(info[1] ~= nil) then
if(info and info[1] ~= nil) then
host["host"] = info[1]
end
if(info[2] ~= nil) then
if(info and info[2] ~= nil) then
host["vlan"] = tonumber(info[2])
else
host["vlan"] = 0

View file

@ -1662,6 +1662,7 @@ if ((ifname == nil) and (_GET ~= nil)) then
if (ifname ~= nil) then
if (ifname .. "" == tostring(tonumber(ifname)) .. "") then
require "label_utils"
-- ifname does not contain the interface name but rather the interface id
ifname = getInterfaceName(ifname, true)
if (ifname == "") then

View file

@ -8,7 +8,7 @@ local clock_start = os.clock()
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
-- require "lua_utils"
require "lua_utils"
local json = require ("dkjson")
local rest_utils = {

View file

@ -176,6 +176,7 @@ end
-- If a point value exceeds this value, it should be discarded as invalid
function ts_common.getMaxPointValue(schema, metric, tags)
require "lua_utils_get"
if tags.ifid ~= nil then
if string.contains(metric, "bytes") then
local ifspeed = getInterfaceSpeed(tonumber(tags.ifid))

View file

@ -3,8 +3,10 @@
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
package.path = dirs.installdir .. "/scripts/lua/modules/timeseries/?.lua;" .. package.path
local ts_utils = require "ts_utils"
require "lua_utils_generic"
local timeseries_info = {}