mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
Add checks to avoid startup failures when plugins metadata does not exist
This commit is contained in:
parent
80da76314d
commit
7191f3e1a5
1 changed files with 17 additions and 1 deletions
|
|
@ -734,7 +734,11 @@ end
|
|||
|
||||
local function load_metadata()
|
||||
if(METADATA == nil) then
|
||||
METADATA = dofile(getMetadataPath())
|
||||
local path = getMetadataPath()
|
||||
|
||||
if ntop.exists(path) then
|
||||
METADATA = dofile(path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -746,6 +750,10 @@ end
|
|||
function plugins_utils.getUserScriptSourcePath(script_path)
|
||||
load_metadata()
|
||||
|
||||
if(not METADATA) then
|
||||
return(nil)
|
||||
end
|
||||
|
||||
local info = METADATA.path_map[script_path]
|
||||
|
||||
if info then
|
||||
|
|
@ -779,6 +787,10 @@ end
|
|||
function plugins_utils.getUserScriptPlugin(script_path)
|
||||
load_metadata()
|
||||
|
||||
if(not METADATA) then
|
||||
return(nil)
|
||||
end
|
||||
|
||||
local info = METADATA.path_map[script_path]
|
||||
|
||||
if info then
|
||||
|
|
@ -793,6 +805,10 @@ end
|
|||
function plugins_utils.getLoadedPlugins()
|
||||
load_metadata()
|
||||
|
||||
if(not METADATA) then
|
||||
return({})
|
||||
end
|
||||
|
||||
return(METADATA.plugins)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue