mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add checks to confirm that the output from xfs_info
has the expected format.
This commit is contained in:
parent
0d2d17ade5
commit
57c67f0c08
1 changed files with 4 additions and 0 deletions
|
@ -103,6 +103,10 @@ def _get_fs_size(fssize_cmd, dev, module):
|
||||||
for line in size.splitlines():
|
for line in size.splitlines():
|
||||||
col = line.split('=')
|
col = line.split('=')
|
||||||
if col[0].strip() == 'data':
|
if col[0].strip() == 'data':
|
||||||
|
if col[1].strip() != 'bsize':
|
||||||
|
module.fail_json(msg='Unexpected output format from xfs_info (could not locate "bsize")')
|
||||||
|
if col[2].split()[1] != 'blocks':
|
||||||
|
module.fail_json(msg='Unexpected output format from xfs_info (could not locate "blocks")')
|
||||||
block_size = int(col[2].split()[0])
|
block_size = int(col[2].split()[0])
|
||||||
block_count = int(col[3].split(',')[0])
|
block_count = int(col[3].split(',')[0])
|
||||||
break
|
break
|
||||||
|
|
Loading…
Add table
Reference in a new issue