Commit e3bdbefa authored by Carla Goncalves Ourofino's avatar Carla Goncalves Ourofino
Browse files

Mostra warning quando alguma configuração não possui sga_name e não existe sga_name default.

[SOMA-3827][SOMA-4163]
parent 332a9974
......@@ -36,23 +36,32 @@ local function get_from_multiple(filename, sga_name, config)
-- Indexes all sga configs by sga_name
local sgas = {}
local warning = ""
local warning = {}
for key, data in ipairs(sgas_data) do
local sga_config, err_msg = {}
sga_config, err_msg = get(data, filename, config)
if sga_config then
if sgas[sga_config.sga_name] then
warning = warning..string.format("[WARNING] Config file %s has duplicate configuration for sga '%s' \n", filename, sga_config.sga_name)
if sga_config.sga_name then
if sgas[sga_config.sga_name] then
table.insert(warning,
string.format("[WARNING] Config file %s has duplicate configuration for sga '%s'", filename, sga_config.sga_name))
end
sgas[sga_config.sga_name] = sga_config
else
table.insert(warning,
string.format("[WARNING] Config file %s has configuration without sga_name:\n %s", filename, data))
end
sgas[sga_config.sga_name] = sga_config
else
warning = warning..string.format("[WARNING] Config file %s has malformed configuration:\n %s \n", filename, data)
table.insert(warning,
string.format("[WARNING] Config file %s has malformed configuration:\n %s", filename, data))
end
end
warning = table.concat(warning, '\n')
local config_data = sgas[sga_name]
if not config_data then
return nil, string.format(err, filename, "'"..sga_name.."' not found")
warning = warning ~= "" and warning..'\n' or ""
return nil, warning..string.format(err, filename, "'"..sga_name.."' not found")
end
return config_data, warning
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment