[stable-2.13] ansible-test - Fix origin host target filtering.

(cherry picked from commit 4b51e61645)

Co-authored-by: Matt Clay <matt@mystile.com>
pull/78246/head
Matt Clay 3 years ago
parent 708e4c206a
commit ee9705a1ce

@ -0,0 +1,5 @@
bugfixes:
- ansible-test - Correctly detect when running as the ``root`` user (UID 0) on the origin host.
The result of the detection was incorrectly being inverted.
- ansible-test - Fix skipping of tests marked ``needs/root`` on the origin host.
- ansible-test - Fix skipping of tests marked ``needs/python`` on the origin host.

@ -221,7 +221,7 @@ class NetworkInventoryTargetFilter(TargetFilter[NetworkInventoryConfig]):
"""Target filter for network inventory."""
class OriginTargetFilter(TargetFilter[OriginConfig]):
class OriginTargetFilter(PosixTargetFilter[OriginConfig]):
"""Target filter for localhost."""

@ -419,7 +419,7 @@ class OriginConfig(ControllerHostConfig, PosixConfig):
@property
def have_root(self): # type: () -> bool
"""True if root is available, otherwise False."""
return os.getuid() != 0
return os.getuid() == 0
@dataclasses.dataclass

Loading…
Cancel
Save