An error occurred while loading the file. Please try again.
-
Hisham authoredcb4d0c62
local exec = {}
local schema = require("schema")
function exec.init(config)
local exec_driver = config.driver_config and config.driver_config.exec_driver or "sga.exec.localhost"
local pok, exec_module = pcall(require, exec_driver)
if not pok then
return nil, exec_module
end
local exec_module_schema = schema.Record {
read_file = schema.Function,
write_file = schema.Function,
remove = schema.Function,
run = schema.Function,
run_write = schema.Function,
run_ok = schema.Function,
time = schema.Function,
new = schema.Function,
}
local err = schema.CheckSchema(exec_module, exec_module_schema)
if err then
return nil, "Error in exec_driver "..exec_driver..": "..tostring(err)
end
return exec_module.new(config.driver_config and config.driver_config.exec_config)
end
return exec