-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When misconfigured cartridge.cfg
fails with dubious error during startup
#2169
Comments
cartridge.cfg
fails with dubious error during startup
Sorry, apparently, I did not fully describe a problem with argument parsing. In the description above I've provided an example, which highlights a problem in $ mkdir -p cfg
$ echo "python: option" > cfg/python.yml
$ echo "cartridge: {a: b}" > cfg/tarantool.yml
$ TARANTOOL_CFG=cfg tarantool -e "require('cartridge.argparse').parse()"
LuajitError: ...hov/Workspace/tarantool/cartridge/cartridge/argparse.lua:283: bad argument #1 to 'pairs' (table expected, got string)
fatal error, exiting the event loop Notice there is the same error, but on the different line of code. But here is the interesting part. If I "fix" a $ echo "python: {c: d}" > cfg/python.yml
$ TARANTOOL_CFG=cfg tarantool -e "require('log').info(require('cartridge.argparse').parse())"
{"cfg":"cfg\/","app_name":"cartridge","a":"b"} In the result output there is no
|
During yet-another-cluster-startup I've ran into an issue when cartridge produced a strange error executing
cartridge.cfg
function:During a brief troubleshooting, I was able to make the shortest reproducer. The problem is within
cartridge.argparse
module. Here is the repro:It turned out, that
argparse
module can load not only a single file, but a whole directory, if specified, in order to get its arguments. But sometimes it is possible for an ops team to accidentally (or intentionally) put inside this directory a config from a different service, which accepts key-value(string) configuration.In this scenario I expect
argparse.parse()
either to get only its own options from a config directory tree, or at least explicitly say that it encountered invalid configuration such asvalidateArgsSchemaError
(better pointing at the file and section location) and not fail with "mysterious" error.I've reproduced it on the latest cartridge version at
master
branch:The text was updated successfully, but these errors were encountered: