Skip to content

Normalize file seed host entries#151003

Open
Radiancebobo wants to merge 2 commits into
elastic:mainfrom
Radiancebobo:fix-file-seed-hosts-trim
Open

Normalize file seed host entries#151003
Radiancebobo wants to merge 2 commits into
elastic:mainfrom
Radiancebobo:fix-file-seed-hosts-trim

Conversation

@Radiancebobo

Copy link
Copy Markdown

Summary

Normalize entries read from unicast_hosts.txt before resolving file-based seed hosts.

Previously, FileBasedSeedHostsProvider passed each non-comment line from the file directly to the seed host resolver. This meant that an otherwise valid entry with leading or trailing whitespace, such as:

 192.168.0.1:9301 

was passed through unchanged and failed during transport address parsing. The same normalization gap also meant that blank lines and indented comments were treated as host entries.

This change strips each line before filtering and resolution, then ignores empty lines and comments after normalization.

Details

  • Strip whitespace from each line read from unicast_hosts.txt.
  • Ignore blank lines after stripping.
  • Ignore comment lines after stripping, so indented comments are handled consistently.
  • Add a focused test covering whitespace, blank lines, and indented comments in the file-based seed hosts provider.

Testing

The following tests were run locally:

./gradlew :server:test --tests org.elasticsearch.discovery.FileBasedSeedHostsProviderTests.testHostEntriesAreTrimmed
./gradlew :server:test --tests org.elasticsearch.discovery.FileBasedSeedHostsProviderTests
./gradlew :server:check

Both passed.

@elasticsearchmachine elasticsearchmachine added v9.5.0 needs:triage Requires assignment of a team area label external-contributor Pull request authored by a developer outside the Elasticsearch team labels Jun 8, 2026
@quinn-harper quinn-harper added >bug :Distributed/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure and removed needs:triage Requires assignment of a team area label labels Jun 8, 2026
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Jun 8, 2026
@elasticsearchmachine

Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Distributed/Discovery-Plugins Anything related to our integration plugins with EC2, GCP and Azure external-contributor Pull request authored by a developer outside the Elasticsearch team Team:Distributed Meta label for distributed team. v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants