summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHungtsetse <33526088+hungtsetse@users.noreply.github.com>2023-09-26 17:12:03 +0200
committerGitHub <noreply@github.com>2023-09-26 17:12:03 +0200
commit51f2ddd445e91765be4decd4f594adf781d15867 (patch)
tree3c5d81605be13cfacb91b2ef6ccd298dad3dfd8c
parentAdd lineinfile integration test for removing a line that has already been rem... (diff)
downloadansible-51f2ddd445e91765be4decd4f594adf781d15867.tar.xz
ansible-51f2ddd445e91765be4decd4f594adf781d15867.zip
Extend mount info (#81768)
-rw-r--r--changelogs/fragments/80478-extend-mount-info.yml2
-rw-r--r--lib/ansible/module_utils/facts/hardware/linux.py5
-rw-r--r--test/units/module_utils/facts/hardware/test_linux.py2
3 files changed, 8 insertions, 1 deletions
diff --git a/changelogs/fragments/80478-extend-mount-info.yml b/changelogs/fragments/80478-extend-mount-info.yml
new file mode 100644
index 0000000000..fcb20e1511
--- /dev/null
+++ b/changelogs/fragments/80478-extend-mount-info.yml
@@ -0,0 +1,2 @@
+minor_changes:
+ - "Add ``dump`` and ``passno`` mount information to facts component (https://github.com/ansible/ansible/issues/80478)"
diff --git a/lib/ansible/module_utils/facts/hardware/linux.py b/lib/ansible/module_utils/facts/hardware/linux.py
index 4e6305cb18..f6e87ac324 100644
--- a/lib/ansible/module_utils/facts/hardware/linux.py
+++ b/lib/ansible/module_utils/facts/hardware/linux.py
@@ -556,6 +556,7 @@ class LinuxHardware(Hardware):
fields = [self._replace_octal_escapes(field) for field in fields]
device, mount, fstype, options = fields[0], fields[1], fields[2], fields[3]
+ dump, passno = int(fields[4]), int(fields[5])
if not device.startswith(('/', '\\')) and ':/' not in device or fstype == 'none':
continue
@@ -563,7 +564,9 @@ class LinuxHardware(Hardware):
mount_info = {'mount': mount,
'device': device,
'fstype': fstype,
- 'options': options}
+ 'options': options,
+ 'dump': dump,
+ 'passno': passno}
if mount in bind_mounts:
# only add if not already there, we might have a plain /etc/mtab
diff --git a/test/units/module_utils/facts/hardware/test_linux.py b/test/units/module_utils/facts/hardware/test_linux.py
index e3e07e7850..4cf89c1469 100644
--- a/test/units/module_utils/facts/hardware/test_linux.py
+++ b/test/units/module_utils/facts/hardware/test_linux.py
@@ -73,12 +73,14 @@ class TestFactsLinuxHardwareGetMountFacts(unittest.TestCase):
'block_total': 105871006,
'block_used': 5713133,
'device': '/dev/mapper/fedora_dhcp129--186-home',
+ 'dump': 0,
'fstype': 'ext4',
'inode_available': 26860880,
'inode_total': 26902528,
'inode_used': 41648,
'mount': '/home',
'options': 'rw,seclabel,relatime,data=ordered',
+ 'passno': 0,
'size_available': 410246647808,
'size_total': 433647640576,
'uuid': 'N/A'}