Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-111546

The kernel_settings role is not idempotent on el7

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Yes
    • Low
    • rhel-system-roles
    • 0
    • False
    • False
    • Hide

      None

      Show
      None
    • Yes
    • None
    • None
    • None
    • Bug Fix
    • Hide
      Cause:
      Consequence:
      Workaround:
      Result:
      Show
      Cause: Consequence: Workaround: Result:
    • Proposed
    • Unspecified
    • Unspecified
    • Unspecified
    • All
    • None

      The kernel_settings role is not idempotent on el7. tests_simple_settings.yml fails when it tries to verify idempotence. The bug was introduced when we switched to using the python configobj library to parse and return the kernel_settings tuned conf file. The problem is that el7 uses python2 which uses an unordered dict to store the values, and the Ansible module code does as well.

      This isn't an issue on el8 and later - python3 dict by default uses ordering.

      The problem is that the data returned by the module is not the same order as in the file, so when the role writes back the data using the template module, the order is different and the role reports changed. This isn't consistent - sometimes the module will preserve the order, but this is not guaranteed.

      The simple fix is to sort the keys before or in the template.

      The harder fix is to have the module return not a dict but a list of lists of key/value pairs.

              rmeggins@redhat.com Richard Megginson
              rmeggins@redhat.com Richard Megginson
              Richard Megginson Richard Megginson
              David Jez David Jez
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: