Validate proxy base path at parse time#47912
Conversation
|
Pinging @elastic/es-core-features (:Core/Features/Monitoring) |
|
@elasticmachine run elasticsearch-ci/bwc |
| if (Strings.isNullOrEmpty(value) == false) { | ||
| try { | ||
| RestClientBuilder.cleanPathPrefix(value); | ||
| } catch (IllegalArgumentException e) { |
There was a problem hiding this comment.
I would suggest to open this up to RuntimeException, else if someone adds something like illegal state exception or a NPE this validation won't kick in and the exception will happen while applying the cluster state.
| (key) -> Setting.simpleString( | ||
| key, | ||
| value -> { | ||
| if (Strings.isNullOrEmpty(value) == false) { |
There was a problem hiding this comment.
what happens if the value is null or empty ? I think the validation here should fail, else it may fail on cluster state application.
There was a problem hiding this comment.
Currently, the REST client builder does not set a proxy base path if the setting's value is null or empty. Do you think it should be changed so the setting itself refuses null or empty values?
There was a problem hiding this comment.
I just realized we actually need to support null as the way to un-set. If the underlying code already protects against empty (e.g. doesn't throw an exception) it should be fine as-is.
jakelandis
left a comment
There was a problem hiding this comment.
A couple items to be more defensive / aggressive in validation.
|
@elastic/es-core-infra, this work covers both monitoring and settings if you want to review it. |
|
@elasticmachine update branch |
|
@jakelandis, I think this is ready for another look. |
Provides parse-time validation for
PROXY_BASE_PATH_SETTINGas described in #47711.