From b82a8576f12e3c0807bcd6aa8a106d4c9d8bfa96 Mon Sep 17 00:00:00 2001 From: Dagobert Michelsen Date: Thu, 19 Feb 2015 15:38:20 +0100 Subject: [PATCH] Add support for mounts in Solaris facts --- lib/ansible/module_utils/facts.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/ansible/module_utils/facts.py b/lib/ansible/module_utils/facts.py index 6d602af736..c28f504c13 100644 --- a/lib/ansible/module_utils/facts.py +++ b/lib/ansible/module_utils/facts.py @@ -971,6 +971,10 @@ class SunOSHardware(Hardware): def populate(self): self.get_cpu_facts() self.get_memory_facts() + try: + self.get_mount_facts() + except TimeoutError: + pass return self.facts def get_cpu_facts(self): @@ -1031,6 +1035,17 @@ class SunOSHardware(Hardware): self.facts['swap_allocated_mb'] = allocated / 1024 self.facts['swap_reserved_mb'] = reserved / 1024 + @timeout(10) + def get_mount_facts(self): + self.facts['mounts'] = [] + # For a detailed format description see mnttab(4) + # special mount_point fstype options time + fstab = get_file_content('/etc/mnttab') + if fstab: + for line in fstab.split('\n'): + fields = line.rstrip('\n').split('\t') + self.facts['mounts'].append({'mount': fields[1], 'device': fields[0], 'fstype' : fields[2], 'options': fields[3], 'time': fields[4]}) + class OpenBSDHardware(Hardware): """ OpenBSD-specific subclass of Hardware. Defines memory, CPU and device facts: