Merge pull request #7543 from yangliping/fix_local_facts_file_checking_portability

Fix portability issue when checking local facts file permission.
pull/8244/head
Michael DeHaan 10 years ago
commit e143d7dab7

@ -16,6 +16,7 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import os import os
import stat
import array import array
import errno import errno
import fcntl import fcntl
@ -177,7 +178,7 @@ class Facts(object):
for fn in sorted(glob.glob(fact_path + '/*.fact')): for fn in sorted(glob.glob(fact_path + '/*.fact')):
# where it will sit under local facts # where it will sit under local facts
fact_base = os.path.basename(fn).replace('.fact','') 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 # run it
# try to read it as json first # try to read it as json first
# if that fails read it with ConfigParser # if that fails read it with ConfigParser

Loading…
Cancel
Save