Repository navigation
fix(roles): derive the version from the package version robustly - #465
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:[:3]turns 7.10.x into7.1(wrong template, silently) and 10.0.x into10.(abort). On Debian/Ubuntupackage_factsreports 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.[:1]turns 10.x into1.x.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_factschecked inrockylinux:9anddebian:13containers, and the expressions tested with ansible against7.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.