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

fix: no longer use "item" as a loop variable

    • rhel-system-roles-1.23.0-2.4.el9
    • sst_system_roles
    • 15
    • 16
    • None
    • QE ack, Dev ack
    • False
    • Hide

      None

      Show
      None
    • Yes
    • Red Hat Enterprise Linux
    • None
    • Bug Fix
    • Hide
      .`selinux` role no longer uses the `item` loop variable

      Previously, the `selinux` RHEL System Role used the  `item` loop variable. This might have resulted in the following warning message when you called the `selinux` role from another role:
      ----
      [WARNING]: TASK: fedora.linux_system_roles.selinux : Restore SELinux labels on filesystem tree: The loop variable 'item' is already in use.
      You should set the `loop_var` value in the `loop_control` option for the task to something else to avoid variable collisions and unexpected behavior.
      ----
      With this release, the `selinux` role uses `__selinux_item` as a loop variable. As a result, the warning that the `item` variable is already in use is no longer displayed even if you call the `selinux` role from another role.
      Show
      .`selinux` role no longer uses the `item` loop variable Previously, the `selinux` RHEL System Role used the  `item` loop variable. This might have resulted in the following warning message when you called the `selinux` role from another role: ---- [WARNING]: TASK: fedora.linux_system_roles.selinux : Restore SELinux labels on filesystem tree: The loop variable 'item' is already in use. You should set the `loop_var` value in the `loop_control` option for the task to something else to avoid variable collisions and unexpected behavior. ---- With this release, the `selinux` role uses `__selinux_item` as a loop variable. As a result, the warning that the `item` variable is already in use is no longer displayed even if you call the `selinux` role from another role.
    • Done
    • None

      By using a different loop variable, we can avoid WARNING messages related to loop variables when calling the `selinux` role from another role.

      Fixes: https://github.com/linux-system-roles/selinux/issues/216 .

      Enhancement: Avoid the warning message:
      ```
      [WARNING]: TASK: fedora.linux_system_roles.selinux : Restore SELinux labels on filesystem tree: The loop variable 'item' is already in use.
      You should set the `loop_var` value in the `loop_control` option for the task to something else to avoid variable collisions and unexpected behavior.
      ```

      Reason: Although I am not aware of any errors when using the role `selinux` without this fix, the warning message (printed in bold and in a different than usual color - violet in my tests) adds lines to the output which can confuse users.

      Result: The warning message `[WARNING]: TASK: ... "The loop variable 'item' is already in use." is no longer displayed when calling the role from another role.

      Issue Tracker Tickets (Jira or BZ if any): N/A

            rmeggins@redhat.com Richard Megginson
            rmeggins@redhat.com Richard Megginson
            Richard Megginson Richard Megginson
            Vaclav Danek Vaclav Danek
            Mirek Jahoda Mirek Jahoda
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: