diff --git a/states/haproxy/scripts/compile.lua b/states/haproxy/scripts/compile.lua index 87d63b4..e08fc87 100644 --- a/states/haproxy/scripts/compile.lua +++ b/states/haproxy/scripts/compile.lua @@ -9,17 +9,16 @@ local group = "haproxy" local libs = {"-ljansson", "-lmaxminddb", "-lcurl"} function compile.check(module) - local sourcepath = modpath.."/"..module..".c" - local binpath = modpath.."/"..module..".so" + local sourcepath = string.format("%s/%s.c", modpath, module) + local binpath = string.format("%s/%s.so", modpath, module) local binexists = io.open(binpath) if not binexists or (binexists and lfs.attributes(sourcepath).change > lfs.attributes(binpath).change ) then - local cmd = "cc -I/usr/include/ -I/usr/include/lua" .. lua_version .. "/ -fPIC -shared -o " .. binpath .. " " .. sourcepath .. " " ..table.concat(libs," ") + local cmd = string.format("cc -I/usr/include/ -I/usr/include/lua%s/ -fPIC -shared -o %s %s %s", lua_version, binpath, sourcepath, table.concat(libs," ")) local res = io.popen(cmd) - local aa = res:read("a*") - io.popen("chown "..user..":"..group.." "..binpath) - io.popen("chmod 600 "..binpath) + io.popen("chown %s:%s %s", user, group, binpath) + io.popen(string.format("chmod 600 %s",binpath)) end end diff --git a/states/haproxy/scripts/state.lua b/states/haproxy/scripts/state.lua index ecd0896..b028a43 100644 --- a/states/haproxy/scripts/state.lua +++ b/states/haproxy/scripts/state.lua @@ -29,7 +29,7 @@ function create_state() lastconns = core.get_info()["CumConns"] if try == 10 then - local msg = "Worker with pid ".. core.get_info()["Pid"] .. " exited for create_state task" + local msg = string.format("Worker with pid %s exited for create_state task",core.get_info()["Pid"]) print(msg) core.done(msg) end diff --git a/states/haproxy/scripts/weight.lua b/states/haproxy/scripts/weight.lua index 834e53d..6be1528 100644 --- a/states/haproxy/scripts/weight.lua +++ b/states/haproxy/scripts/weight.lua @@ -58,7 +58,7 @@ function arrange_backends() lastconns = core.get_info()["CumConns"] if try == 10 then - local msg = "Worker with pid ".. core.get_info()["Pid"] .. " exited for arrange_backends task" + local msg = string.format("Worker with pid %s exited for arrange_backends task", core.get_info()["Pid"]) print(msg) core.done(msg) end