mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-04 21:24:24 -07:00
aix_facts: statvfs works on AIX too so make use of it (#46759)
This commit is contained in:
parent
1e3b704ff1
commit
58ae93d273
1 changed files with 21 additions and 10 deletions
|
@ -19,6 +19,7 @@ __metaclass__ = type
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ansible.module_utils.facts.hardware.base import Hardware, HardwareCollector
|
from ansible.module_utils.facts.hardware.base import Hardware, HardwareCollector
|
||||||
|
from ansible.module_utils.facts.utils import get_mount_size
|
||||||
|
|
||||||
|
|
||||||
class AIXHardware(Hardware):
|
class AIXHardware(Hardware):
|
||||||
|
@ -175,6 +176,9 @@ class AIXHardware(Hardware):
|
||||||
mount_facts = {}
|
mount_facts = {}
|
||||||
|
|
||||||
mount_facts['mounts'] = []
|
mount_facts['mounts'] = []
|
||||||
|
|
||||||
|
mounts = []
|
||||||
|
|
||||||
# AIX does not have mtab but mount command is only source of info (or to use
|
# AIX does not have mtab but mount command is only source of info (or to use
|
||||||
# api calls to get same info)
|
# api calls to get same info)
|
||||||
mount_path = self.module.get_bin_path('mount')
|
mount_path = self.module.get_bin_path('mount')
|
||||||
|
@ -185,11 +189,13 @@ class AIXHardware(Hardware):
|
||||||
if len(fields) != 0 and fields[0] != 'node' and fields[0][0] != '-' and re.match('^/.*|^[a-zA-Z].*|^[0-9].*', fields[0]):
|
if len(fields) != 0 and fields[0] != 'node' and fields[0][0] != '-' and re.match('^/.*|^[a-zA-Z].*|^[0-9].*', fields[0]):
|
||||||
if re.match('^/', fields[0]):
|
if re.match('^/', fields[0]):
|
||||||
# normal mount
|
# normal mount
|
||||||
mount_facts['mounts'].append({'mount': fields[1],
|
mount = fields[1]
|
||||||
'device': fields[0],
|
mount_info = {'mount': mount,
|
||||||
'fstype': fields[2],
|
'device': fields[0],
|
||||||
'options': fields[6],
|
'fstype': fields[2],
|
||||||
'time': '%s %s %s' % (fields[3], fields[4], fields[5])})
|
'options': fields[6],
|
||||||
|
'time': '%s %s %s' % (fields[3], fields[4], fields[5])}
|
||||||
|
mount_info.update(get_mount_size(mount))
|
||||||
else:
|
else:
|
||||||
# nfs or cifs based mount
|
# nfs or cifs based mount
|
||||||
# in case of nfs if no mount options are provided on command line
|
# in case of nfs if no mount options are provided on command line
|
||||||
|
@ -197,11 +203,16 @@ class AIXHardware(Hardware):
|
||||||
if len(fields) < 8:
|
if len(fields) < 8:
|
||||||
fields.append("")
|
fields.append("")
|
||||||
|
|
||||||
mount_facts['mounts'].append({'mount': fields[2],
|
mount_info = {'mount': fields[2],
|
||||||
'device': '%s:%s' % (fields[0], fields[1]),
|
'device': '%s:%s' % (fields[0], fields[1]),
|
||||||
'fstype': fields[3],
|
'fstype': fields[3],
|
||||||
'options': fields[7],
|
'options': fields[7],
|
||||||
'time': '%s %s %s' % (fields[4], fields[5], fields[6])})
|
'time': '%s %s %s' % (fields[4], fields[5], fields[6])}
|
||||||
|
|
||||||
|
mounts.append(mount_info)
|
||||||
|
|
||||||
|
mount_facts['mounts'] = mounts
|
||||||
|
|
||||||
return mount_facts
|
return mount_facts
|
||||||
|
|
||||||
def get_device_facts(self):
|
def get_device_facts(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue