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

fix: tempdir path not defined in check mode; __selinux_item.path may be undefined

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

    • rhel-system-roles
    • 0
    • Dev ack
    • False
    • False
    • Hide

      None

      Show
      None
    • Yes
    • Red Hat Enterprise Linux
    • None
    • Bug Fix
    • Hide
      .`selinux` role no longer produces error due to undefined `tempdir` path in Ansible check mode

      Before this update, the `tempdir` path was not defined in Ansible check mode, and the `__selinux_item.path` could be undefined. Consequently, when running in check mode, the `selinux` RHEL system role produced an error that various variables are undefined. With this update, the role skips tasks that require the `tempdir.path` to be defined, and can handle cases where variables are undefined. As a result, the role works correctly in check mode.
      Show
      .`selinux` role no longer produces error due to undefined `tempdir` path in Ansible check mode Before this update, the `tempdir` path was not defined in Ansible check mode, and the `__selinux_item.path` could be undefined. Consequently, when running in check mode, the `selinux` RHEL system role produced an error that various variables are undefined. With this update, the role skips tasks that require the `tempdir.path` to be defined, and can handle cases where variables are undefined. As a result, the role works correctly in check mode.
    • Done
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      Cause: tempdir path is not defined in check mode, and __selinux_item.path may be undefined
      in some cases.

      Consequence: The role will give an error when running in check mode that various
      variables are undefined.

      Fix: Skip tasks that require tempdir.path to be defined. Handle cases where variables
      may be undefined.

      Result: The role works in check mode.

      Signed-off-by: Rich Megginson <rmeggins@redhat.com>

        1. Summary by Sourcery

      Enable Ansible check mode support in selinux_load_module by guarding against undefined tempdir.path and __selinux_item.path.

      Bug Fixes:

      • Guard copy, install, and cleanup tasks against undefined tempdir.path to prevent errors in check mode
      • Provide a default for __selinux_item.path when copying modules to avoid undefined path errors

      Enhancements:

      • Skip filesystem operations requiring tempdir.path when it is not defined to improve check mode compatibility

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

                Created:
                Updated: