Skip to content

Commit

Permalink
lib.ptree: support scalar value app configs in action_codec
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Aug 18, 2022
1 parent 7d7b0ed commit a5523ea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/ptree/action_codec.lua
Expand Up @@ -125,12 +125,15 @@ local function encoder()
self:string(name)
end
function encoder:config(class, arg)
local ad_hoc_encodable = {
table=true, cdata=true, number=true, string=true, boolean=true
}
local file_name
if class.yang_schema then
file_name = random_file_name()
yang.compile_config_for_schema_by_name(class.yang_schema, arg,
file_name)
elseif type(arg) == 'table' then
elseif ad_hoc_encodable[type(arg)] then
file_name = random_file_name()
binary.compile_ad_hoc_lua_data_to_file(file_name, arg)
elseif arg == nil then
Expand Down

0 comments on commit a5523ea

Please sign in to comment.