From 6e66ea9f78ea05bb6cf500fa7b910e74e8997618 Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Fri, 24 May 2019 20:23:47 +0200 Subject: [PATCH] Properly detect is_chroot fact on XFS for non-root (#56899) Fixes #56437 --- changelogs/fragments/56437-is_chroot-xfs.yaml | 2 ++ lib/ansible/module_utils/facts/system/chroot.py | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 changelogs/fragments/56437-is_chroot-xfs.yaml diff --git a/changelogs/fragments/56437-is_chroot-xfs.yaml b/changelogs/fragments/56437-is_chroot-xfs.yaml new file mode 100644 index 00000000000..011d4a2af61 --- /dev/null +++ b/changelogs/fragments/56437-is_chroot-xfs.yaml @@ -0,0 +1,2 @@ +bugfixes: + - facts - properly detect is_chroot on XFS for non-root users (https://github.com/ansible/ansible/issues/56437) diff --git a/lib/ansible/module_utils/facts/system/chroot.py b/lib/ansible/module_utils/facts/system/chroot.py index 1d99d4568e5..25c61125d5d 100644 --- a/lib/ansible/module_utils/facts/system/chroot.py +++ b/lib/ansible/module_utils/facts/system/chroot.py @@ -31,6 +31,8 @@ def is_chroot(module=None): rc, out, err = module.run_command(cmd) if 'btrfs' in out: fs_root_ino = 256 + elif 'xfs' in out: + fs_root_ino = 128 is_chroot = (my_root.st_ino != fs_root_ino)