From aedf134fc40268fbee42f9c2b908847513059ec6 Mon Sep 17 00:00:00 2001 From: Yang Liping Date: Mon, 26 May 2014 10:55:32 +0800 Subject: [PATCH] Fix portability issue when checking local facts file permission. --- lib/ansible/module_utils/facts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index bcdfd2a7e0d..33de1b2a59b 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -16,6 +16,7 @@ # along with Ansible. If not, see . import os +import stat import array import errno import fcntl @@ -173,7 +174,7 @@ class Facts(object): for fn in sorted(glob.glob(fact_path + '/*.fact')): # where it will sit under local facts fact_base = os.path.basename(fn).replace('.fact','') - if os.access(fn, os.X_OK): + if stat.S_IXUSR & os.stat(fn)[stat.ST_MODE]: # run it # try to read it as json first # if that fails read it with ConfigParser