Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csbase-dev
sgarest-daemon
Commits
e3bdbefa
Commit
e3bdbefa
authored
Apr 01, 2020
by
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
sga/configuration.lua
View file @
e3bdbefa
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment