Unit tests with filesystem-related mocks fail in SeLinuxGuard when run on RHEL or CentOS

Bug #1825253 reported by Jason Zions on 2019-04-17
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Jason Zions

Bug Description

When the unit tests are run on RHEL or CentOS, some tests which mock filesystem directories so as to "lie" about things can cause util.SeLinuxGuard to fail. The SeLinuxGuard does nothing in environments which lack the selinux python module or when that module reports that selinux is not enabled. When the guard is functional, though, it can be confused by some mocks used in various tests.






In the first four cases, the tests mock os.path.realpath by remapping path prefixes to point to a temporary directory, but SeLinuxGuard doesn't see the mapping. In the last case, the test case mocks os.path.islink to lie and claim a directory is actually a symlink, but code invoked by SeLinuxGuard gets very confused when it tries to treat the (quite real) directory as if it were a symlink.

Related branches

Dan Watkins (oddbloke) on 2019-04-18
Changed in cloud-init:
status: New → In Progress
assignee: nobody → Jason Zions (jasonzio)

This bug is fixed with commit c8c32515 to cloud-init on branch master.
To view that commit see the following URL:

Changed in cloud-init:
status: In Progress → Fix Committed

This bug is believed to be fixed in cloud-init in version 19.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers