Skip to content

fix(roles): derive the version from the package version robustly - #465

Merged
NavidSassan merged 3 commits into
mainfrom
fix/graylog-version-detection
Oct 21, 2026
Merged

NavidSassan merged 3 commits into
mainfrom
fix/graylog-version-detection

Conversation

@NavidSassan

Copy link
Copy Markdown
Member

The graylog, opensearch and mongodb roles pick their configuration template from the installed package version, and cut it with string slicing or a regex that only strips a trailing .N:

  • graylog_server / graylog_datanode: [:3] turns 7.10.x into 7.1 (wrong template, silently) and 10.0.x into 10. (abort). On Debian/Ubuntu package_facts reports the version with the Debian revision (verified on Debian 13: 5.2.37-2+b9); the old regex did not strip it, and [:3] only hid that.
  • opensearch: [:1] turns 10.x into 1.x.
  • mongodb: a Debian revision would break the lookup. The current MongoDB DEBs carry none (8.0.34), so this is hardening only.

All now use regex_search('^\d+\.\d+') / regex_search('^\d+'). No CHANGELOG entry: every release that exists today maps to the same template as before.

Test

No Molecule scenario covers these roles. package_facts checked in rockylinux:9 and debian:13 containers, and the expressions tested with ansible against 7.2.1, 7.2.1-1, 7.10.3(-1), 10.0.0(-1), 6.1.12, 2.19.7(-1), 10.0.1, 8.0.34, 8.0.4-1. ansible-lint and pre-commit pass on the changed files.

… from the package version robustly

The version was cut to its first three characters, so 7.10.x would select
the 7.1 template and 10.0.x would abort. On Debian/Ubuntu, package_facts
reports the version with the Debian revision (verified on Debian 13), which
the previous regex did not strip.
…ion robustly

The major was cut to the first character, so OpenSearch 10.x would select the 1.x template.
The previous regex only stripped a trailing patch number, so a Debian revision (8.0.4-1) would have broken the template lookup. The current MongoDB DEBs carry none.
@NavidSassan
NavidSassan merged commit 24bf15e into main Oct 21, 2026
13 checks passed
@NavidSassan
NavidSassan deleted the fix/graylog-version-detection branch October 21, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant