Skip to content

Commit c590ff4

Browse files
committed
fix: ensure idempotence by writing settings in sorted order
Cause: On EL7, the underlying module uses an unordered dict, so the order of the settings being written can change between role invocations. Consequence: The role may report changed when nothing actually changed except the order. Fix: The settings are sorted before being written so that the order is consistent. Result: The role does not report changed when nothing has changed. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
1 parent 04a7572 commit c590ff4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

templates/kernel_settings.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
{{ "system_role:kernel_settings" | comment(prefix="", postfix="") }}
33
{% macro write_section(section_name, settings) %}
44
[{{ section_name }}]
5-
{% for key, val in settings.items() %}
5+
{% for key in settings.keys() | sort %}
6+
{% set val = settings[key] %}
67
{% if val != {"state": "absent"} %}
78
{{ key }} = {{ val }}
89
{% endif %}

0 commit comments

Comments
 (0)