kernel_module_disable template - regexp matches multiple lines #10351
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.
Regular expression matches both lines in the {{KERNMODULE}}.conf file and this causes duplicate lines in Oracle Linux and RHEL every time the ansible script is executed. Regular expression was changed to also search for the keyword "install"
Description:
The regular expression for the line "install {{KERNMODULE}} /bin/true" is only "{{KERNMODULE}}"
This causes duplicate lines in the modprobe.d/*.conf files
Rationale:
In case of Oracle Linux or RHEL, there are 2 lines in the {{KERNMODULE}}.conf file and the regular expression will match always the last match (according to ansible documentation).
For example for udf:
Old regexp would be
udf
and would matchblacklist udf
New regexp would be
install\s+udf
and would matchinstall udf /bin/true
With old regexp the file would look like this:
With new regexp the file would look like this:
Review Hints:
The second part of the ansible block takes care of the blacklist line, so with the old regexp the result would be actually: