Skip to content

Commit

Permalink
Fixed invalid config parsing in argparse
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvar-antonsson committed Dec 13, 2023
1 parent be208ad commit 504a4ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ Fixed

- An error with ``cartridge.utils.version_is_at_least`` parsing.

- Error in argparse when invalid config file was provided
(`#2169 <https://github.com/tarantool/cartridge/issues/2169>`_).

-------------------------------------------------------------------------------
[2.8.4] - 2023-10-31
-------------------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions cartridge/argparse.lua
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ local function parse_file(filename, search_name)
local ret = {}
for _, section_name in ipairs(section_names) do
local content = file_sections[section_name] or {}
if type(content) ~= 'table' then
return nil, ParseConfigError:new('Invalid content: options should be '..
'in format `name: value`')
end

for argname, argvalue in pairs(content) do
ret[argname:lower()] = argvalue
Expand Down

0 comments on commit 504a4ab

Please sign in to comment.