From 3c75808c5c36a7529a93ac1bba9014907fa3e349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20Cor=C3=A9?= Date: Thu, 6 Apr 2017 18:42:45 +0200 Subject: [PATCH] fix incorrect parsing of xfs_info when device name ends with 'data' line matches in : - if 'data ' in line: closes #23352 --- lib/ansible/modules/system/filesystem.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/system/filesystem.py b/lib/ansible/modules/system/filesystem.py index 67ee2da794..5ae9935914 100644 --- a/lib/ansible/modules/system/filesystem.py +++ b/lib/ansible/modules/system/filesystem.py @@ -101,10 +101,10 @@ def _get_fs_size(fssize_cmd, dev, module): rc, size, err = module.run_command("%s %s" % (cmd, dev)) if rc == 0: for line in size.splitlines(): - #if 'data' in line: - if 'data ' in line: - block_size = int(line.split('=')[2].split()[0]) - block_count = int(line.split('=')[3].split(',')[0]) + col = line.split('=') + if col[0].strip() == 'data': + block_size = int(col[2].split()[0]) + block_count = int(col[3].split(',')[0]) break else: module.fail_json(msg="Failed to get block count and block size of %s with %s" % (dev, cmd), rc=rc, err=err )