Skip to content
Snippets Groups Projects
Commit a1d685f3 authored by Konstantin Belyavskiy's avatar Konstantin Belyavskiy Committed by Vladimir Davydov
Browse files

lua: fix for option pid_file overwritten by tarantoolctl

During startup tarantoolctl ignores 'pid_file' option and set it to
default value.
This cause a fault if user tries to execute config with option set.
In case of being started with tarantoolctl shadow this option with
additional wrapper around box.cfg.

Closes #3214
parent dcac64af
No related branches found
No related tags found
No related merge requests found
......@@ -527,6 +527,13 @@ local function start()
end
os.exit(1)
end
local old_call = getmetatable(box.cfg).__call
getmetatable(box.cfg).__call = function(old_cfg, cfg)
if old_cfg.pid_file ~= nil and cfg ~= nil and cfg.pid_file ~= nil then
cfg.pid_file = old_cfg.pid_file
end
old_call(old_cfg, cfg)
end
return 0
end
......
......@@ -365,6 +365,36 @@ test_run:cmd("cleanup server cfg_tester4")
- true
...
--------------------------------------------------------------------------------
-- Check fix for pid_file option overwritten by tarantoolctl
--------------------------------------------------------------------------------
test_run:cmd('create server cfg_tester5 with script = "box/lua/cfg_test1.lua"')
---
- true
...
test_run:cmd("start server cfg_tester5")
---
- true
...
test_run:cmd('switch cfg_tester5')
---
- true
...
box.cfg{pid_file = "current.pid"}
---
...
test_run:cmd("switch default")
---
- true
...
test_run:cmd("stop server cfg_tester5")
---
- true
...
test_run:cmd("cleanup server cfg_tester5")
---
- true
...
--------------------------------------------------------------------------------
-- Check that 'vinyl_dir' cfg option is not checked as long as
-- there is no vinyl indexes (issue #2664)
--------------------------------------------------------------------------------
......
......@@ -69,6 +69,18 @@ test_run:cmd("switch default")
test_run:cmd("stop server cfg_tester4")
test_run:cmd("cleanup server cfg_tester4")
--------------------------------------------------------------------------------
-- Check fix for pid_file option overwritten by tarantoolctl
--------------------------------------------------------------------------------
test_run:cmd('create server cfg_tester5 with script = "box/lua/cfg_test1.lua"')
test_run:cmd("start server cfg_tester5")
test_run:cmd('switch cfg_tester5')
box.cfg{pid_file = "current.pid"}
test_run:cmd("switch default")
test_run:cmd("stop server cfg_tester5")
test_run:cmd("cleanup server cfg_tester5")
--------------------------------------------------------------------------------
-- Check that 'vinyl_dir' cfg option is not checked as long as
-- there is no vinyl indexes (issue #2664)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment