mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-03 17:30:11 +00:00
Reported traceback when setting empty value
This commit is contained in:
parent
1a75665d77
commit
5700432c6e
1 changed files with 31 additions and 7 deletions
|
|
@ -60,11 +60,19 @@ end
|
|||
-- ##############################################
|
||||
|
||||
function cache_utils.sethostname(ipaddr, name)
|
||||
if(debugme) then
|
||||
tprint("cache_utils.sethostname(".. ipaddr .. ", ".. name..")")
|
||||
local val = name or ipaddr
|
||||
|
||||
if(not isEmptyString(val)) then
|
||||
if(debugme) then
|
||||
tprint("cache_utils.sethostname(".. ipaddr .. ", ".. name..")")
|
||||
end
|
||||
|
||||
return(ntop.setLuaCache("host."..ipaddr, val))
|
||||
else
|
||||
tprint("Empty cache_utils.sethostname() value")
|
||||
tprint(debug.traceback())
|
||||
return(false)
|
||||
end
|
||||
|
||||
return(ntop.setLuaCache("host."..ipaddr, name or ipaddr))
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
|
@ -87,18 +95,34 @@ end
|
|||
-- ##############################################
|
||||
|
||||
function cache_utils.setifname(ipaddr, ifid, ifname)
|
||||
local val
|
||||
|
||||
if(ifname == nil) then
|
||||
tprint("cache_utils.setifname() ERROR on interface "..ipaddr.." / "..ifid)
|
||||
tprint(debug.traceback())
|
||||
end
|
||||
|
||||
return(ntop.setLuaCache("iface."..ipaddr.."@"..ifid, ifname or ifid))
|
||||
|
||||
val = ifname or ifid
|
||||
|
||||
if(not isEmptyString(val)) then
|
||||
return(ntop.setLuaCache("iface."..ipaddr.."@"..ifid, val))
|
||||
else
|
||||
tprint("Empty cache_utils.setifname() value")
|
||||
tprint(debug.traceback())
|
||||
return(false)
|
||||
end
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
||||
function cache_utils.set(key, val)
|
||||
ntop.setLuaCache(key, val)
|
||||
if(not isEmptyString(val)) then
|
||||
ntop.setLuaCache(key, val)
|
||||
else
|
||||
tprint("Empty cache_utils.set() value")
|
||||
tprint(debug.traceback())
|
||||
return(false)
|
||||
end
|
||||
end
|
||||
|
||||
-- ##############################################
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue