| 1 |
# This file is part of Ansible |
| 2 |
# |
| 3 |
# Ansible is free software: you can redistribute it and/or modify |
| 4 |
# it under the terms of the GNU General Public License as published by |
| 5 |
# the Free Software Foundation, either version 3 of the License, or |
| 6 |
# (at your option) any later version. |
| 7 |
# |
| 8 |
# Ansible is distributed in the hope that it will be useful, |
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
# GNU General Public License for more details. |
| 12 |
# |
| 13 |
# You should have received a copy of the GNU General Public License |
| 14 |
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
|
| 16 |
from __future__ import annotations |
| 17 |
|
| 18 |
from ansible.module_utils.facts.timeout import TimeoutError |
| 19 |
from ansible.module_utils.facts.hardware.base import HardwareCollector |
| 20 |
from ansible.module_utils.facts.hardware.linux import LinuxHardware |
| 21 |
|
| 22 |
|
| 23 |
class HurdHardware(LinuxHardware): |
| 24 |
""" |
| 25 |
GNU Hurd specific subclass of Hardware. Define memory and mount facts |
| 26 |
based on procfs compatibility translator mimicking the interface of |
| 27 |
the Linux kernel. |
| 28 |
""" |
| 29 |
|
| 30 |
platform = 'GNU' |
| 31 |
|
| 32 |
def populate(self, collected_facts=None): |
| 33 |
hardware_facts = {} |
| 34 |
uptime_facts = self.get_uptime_facts() |
| 35 |
memory_facts = self.get_memory_facts() |
| 36 |
|
| 37 |
mount_facts = {} |
| 38 |
try: |
| 39 |
mount_facts = self.get_mount_facts() |
| 40 |
except TimeoutError: |
| 41 |
pass |
| 42 |
|
| 43 |
hardware_facts.update(uptime_facts) |
| 44 |
hardware_facts.update(memory_facts) |
| 45 |
hardware_facts.update(mount_facts) |
| 46 |
|
| 47 |
return hardware_facts |
| 48 |
|
| 49 |
|
| 50 |
class HurdHardwareCollector(HardwareCollector): |
| 51 |
_fact_class = HurdHardware |
| 52 |
_platform = 'GNU' |