fixup! Allow for options containing commas

This commit is contained in:
Tobias Klaus 2021-02-16 09:50:36 +01:00
parent a5f1bb0821
commit aa19e1cfd3

View file

@ -184,13 +184,17 @@ function set_value(module)
local target = p["value"] local target = p["value"]
local force = p["force"] local force = p["force"]
originaltype = type(target)
if (force == "option" and type(target) == "table") or type(target) == "table" and #target == 1 then if ( force == "option" and type(target) == "table" ) or type(target) == "table" and #target == 1 and force~='list' then
target = table.concat(target, ',') target = table.concat(target, ',')
elseif force == "list" and (type(target) == "string" or type(target) == "number" ) then elseif force == "list" and ( type(target) ~= "table" or type(target) == "string" ) then
target = { target } target = { target }
end end
if force == "list" and type(target) ~= "table" then
module:fail_json({msg="original " .. originaltype .. " type is " .. type(target), message=message})
end
local values = {} local values = {}
if path["option"] then if path["option"] then
values[path["option"]] = target values[path["option"]] = target