From f61bb76a867f7b8bfd2279a7c0e1a482a141331e Mon Sep 17 00:00:00 2001 From: "softwarefactory-project-zuul[bot]" <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 02:59:28 +0000 Subject: [PATCH] Merge pull request #597 from vbotka/mount-fix-comment Remove comment from fstab entry on updating. SUMMARY Fix #595. ISSUE TYPE Bugfix Pull Request COMPONENT NAME ansible.posix.mount ADDITIONAL INFORMATION Reviewed-by: Hideki Saito Reviewed-by: Vladimir Botka --- changelogs/fragments/597_remove_fstab_comment_on_updating.yml | 3 +++ plugins/modules/mount.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/597_remove_fstab_comment_on_updating.yml diff --git a/changelogs/fragments/597_remove_fstab_comment_on_updating.yml b/changelogs/fragments/597_remove_fstab_comment_on_updating.yml new file mode 100644 index 0000000..c1c51a9 --- /dev/null +++ b/changelogs/fragments/597_remove_fstab_comment_on_updating.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - mount - If a comment is appended to a fstab entry, state present creates a double-entry (https://github.com/ansible-collections/ansible.posix/issues/595). diff --git a/plugins/modules/mount.py b/plugins/modules/mount.py index dadbd46..b9e496e 100644 --- a/plugins/modules/mount.py +++ b/plugins/modules/mount.py @@ -303,7 +303,7 @@ def _set_mount_save_old(module, args): continue - fields = line.split() + fields = line.split('#')[0].split() # Check if we got a valid line for splitting # (on Linux the 5th and the 6th field is optional)