Skip to content

Commit

Permalink
snabb config: use consistency checker in command parsing
Browse files Browse the repository at this point in the history
Used to be that configurations read from the command line or stdin bypassed the
consistency checker.
  • Loading branch information
eugeneia committed Dec 12, 2019
1 parent 19072b4 commit ae4f734
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/program/config/common.lua
Expand Up @@ -10,6 +10,7 @@ local file = require("lib.stream.file")
local rpc = require("lib.yang.rpc")
local yang = require("lib.yang.yang")
local data = require("lib.yang.data")
local path_data = require("lib.yang.path_data")
local path_resolver = require("lib.yang.path_data").resolver

function show_usage(command, status, err_msg)
Expand Down Expand Up @@ -38,7 +39,14 @@ end

function data_parser(schema_name, path, is_config)
local grammar = path_grammar(schema_name, path, is_config)
return data.data_parser_from_grammar(grammar)
local parser = data.data_parser_from_grammar(grammar)
local validator = path_data.consistency_checker_from_grammar(grammar)
return function (data)
local config = parser(data)
validator(config)
print("validated")
return config
end
end

function config_parser(schema_name, path)
Expand Down

0 comments on commit ae4f734

Please sign in to comment.