This PR changes the way how we handle configuration errors during startup. The original logic stopped on first encountered error, forcing user to fix it and try again, which could repeat several times and leads to tiresome process. The new logic discovers and reports all problems at once, making it easy to fix in one go.
Removed duplicated configuration processing during the datanode startup, which I assume, was a copy-paste error.
2024-07-02 09:19:25,504 ERROR: org.graylog.datanode.bootstrap.CmdLineTool - Invalid configuration
com.github.joschi.jadconfig.ParameterException: Required parameter "opensearch_data_location" not found.
at com.github.joschi.jadconfig.JadConfig.processClassField(JadConfig.java:173) ~[jadconfig-0.15.0.jar:?]
at com.github.joschi.jadconfig.JadConfig.processClassFields(JadConfig.java:143) ~[jadconfig-0.15.0.jar:?]
at com.github.joschi.jadconfig.JadConfig.process(JadConfig.java:103) ~[jadconfig-0.15.0.jar:?]
at org.graylog.datanode.bootstrap.CmdLineTool.processConfiguration(CmdLineTool.java:422) [classes/:?]
at org.graylog.datanode.bootstrap.CmdLineTool.parseAndGetConfiguration(CmdLineTool.java:310) [classes/:?]
at org.graylog.datanode.bootstrap.CmdLineTool.doRun(CmdLineTool.java:266) [classes/:?]
at org.graylog.datanode.bootstrap.CmdLineTool.run(CmdLineTool.java:246) [classes/:?]
at org.graylog.datanode.bootstrap.Main.main(Main.java:57) [classes/:?]
After, collecting all errors and then failing:
2024-07-02 09:21:06,927 ERROR: org.graylog.datanode.bootstrap.CmdLineTool - Invalid configuration
com.github.joschi.jadconfig.LazyValidationException: Following errors ocurred during configuration processing:
Required parameter "opensearch_data_location" not found.
Required parameter "opensearch_config_location" not found.
Required parameter "opensearch_logs_location" not found.
at com.github.joschi.jadconfig.JadConfig.processFailingLazily(JadConfig.java:118) ~[jadconfig-0.15.0.jar:?]
at org.graylog.datanode.bootstrap.CmdLineTool.processConfiguration(CmdLineTool.java:422) [classes/:?]
at org.graylog.datanode.bootstrap.CmdLineTool.parseAndGetConfiguration(CmdLineTool.java:310) [classes/:?]
at org.graylog.datanode.bootstrap.CmdLineTool.doRun(CmdLineTool.java:266) [classes/:?]
at org.graylog.datanode.bootstrap.CmdLineTool.run(CmdLineTool.java:246) [classes/:?]
at org.graylog.datanode.bootstrap.Main.main(Main.java:57) [classes/:?]
Types of changes
[ ] Bug fix (non-breaking change which fixes an issue)
[x] New feature (non-breaking change which adds functionality)
[ ] Refactoring (non-breaking change)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[x] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
This PR changes the way how we handle configuration errors during startup. The original logic stopped on first encountered error, forcing user to fix it and try again, which could repeat several times and leads to tiresome process. The new logic discovers and reports all problems at once, making it easy to fix in one go.
Removed duplicated configuration processing during the datanode startup, which I assume, was a copy-paste error.
Description
See https://github.com/Graylog2/JadConfig/pull/127
Motivation and Context
Fixes https://github.com/Graylog2/graylog2-server/issues/19207
How Has This Been Tested?
Manually
Screenshots (if appropriate):
Before, stopping at the first error:
After, collecting all errors and then failing:
Types of changes
Checklist: