Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mount module fails on nfs mounts with "as it does not exist' #65855

Closed
wirerydr opened this issue Dec 15, 2019 · 12 comments · Fixed by ansible-collections/ansible.posix#33
Closed
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. collection:ansible.posix collection Related to Ansible Collections work has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. system System category

Comments

@wirerydr
Copy link

wirerydr commented Dec 15, 2019

SUMMARY

When using the ansible 'mount' module to mount an NFS export, the play fails with an error containing "... as it does not exist".

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Ansible module mount

ANSIBLE VERSION
ansible 2.10.0.dev0
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /var/data/src/ansible/lib/ansible
  executable location = /var/data/src/ansible/bin/ansible
  python version = 3.7.5 (default, Oct 17 2019, 12:16:48) [GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]
CONFIGURATION
COLOR_VERBOSE(/etc/ansible/ansible.cfg) = dark gray
RETRY_FILES_ENABLED(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Output of hostnamectl:

hostnamectl
   Static hostname: ansible-f31.example.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 9af65fda237345db8f54e2fff640148b
           Boot ID: 88abdd71dcf048ea90680629998be20c
    Virtualization: vmware
  Operating System: Fedora 31 (Thirty One)
       CPE OS Name: cpe:/o:fedoraproject:fedora:31
            Kernel: Linux 5.3.15-300.fc31.x86_64
      Architecture: x86-64
STEPS TO REPRODUCE

It appears that commit d2f45da changed the mount module in such a way that will always fail when working with NFS remote mounts.

The commit resulted in code including the following snippet:

    elif state == 'mounted':
        if not os.path.exists(args['src']):
             module.fail_json(msg="Unable to mount %s as it does not exist" % args['src']) 

This would seem to always fail. Simply commenting out lines 2 and 3 in the above snippet restores successful completion.

EXPECTED RESULTS

When doing NFS mounts, Ansible should either use something like showmount` -e <nfsservername> to verify if the remote export exists, or skip validation entirely in the case of NFS mounts.

ACTUAL RESULTS

The play fails with an error including the text "as it does not exist".


@ansibot
Copy link
Contributor

ansibot commented Dec 15, 2019

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Dec 15, 2019
@ansibot
Copy link
Contributor

ansibot commented Dec 15, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Dec 15, 2019

cc @jtyr
click here for bot help

@ansibot ansibot added module This issue/PR relates to a module. system System category labels Dec 15, 2019
@Akasurde
Copy link
Member

resolved_by_pr #65544

@Akasurde
Copy link
Member

@wirerydr, Could you please check PR #65544 and let us know if it works for you ?

Please check How to test a PR for more help.

Thanks.

needs_info

@ansibot ansibot added needs_info This issue requires further information. Please answer any outstanding questions. and removed needs_triage Needs a first human triage before being processed. labels Dec 16, 2019
@wirerydr
Copy link
Author

wirerydr commented Dec 17, 2019

@wirerydr, Could you please check PR #65544 and let us know if it works for you ?

Please check How to test a PR for more help.

Thanks.

needs_info

Tested PR #65544 within the (otherwise) same environment that originally manifested my problem, as documented by this bug report. The following scenarios were tested:

  1. With new Mount module parameter verify_src omitted. Originally-documented error re-manifested. Results as expected, as-per documented default value of yes.
  2. With verify_src=yes. Originally-documented error re-manifested. Results as expected.
  3. With verify_src=no. The play now completed successfully, fstab was correctly updated, and the mounts were all successfully mounted. Results as expected.

This would seem to address the issue raised by this bug-report, at-least for me. Thank you very much for the quick turnaround.

@ansibot
Copy link
Contributor

ansibot commented Jan 18, 2020

@wirerydr This issue is waiting for your response. Please respond or the issue will be closed.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Feb 19, 2020

@wirerydr You have not responded to information requests in this issue so we will assume it no longer affects you. If you are still interested in this, please create a new issue with the requested information.

click here for bot help

@ansibot ansibot closed this as completed Feb 19, 2020
@patrakov
Copy link

patrakov commented Mar 8, 2020

Please reopen, the bug is still there, and has a pull request, #65869

@s-hertel
Copy link
Contributor

Reopening as per above. Not exactly sure why the bot closed this.

bot_status

@s-hertel s-hertel reopened this Mar 11, 2020
@ansibot
Copy link
Contributor

ansibot commented Mar 11, 2020

Components

lib/ansible/modules/system/mount.py
support: core
maintainers: ansible jtyr

Metadata

waiting_on: wirerydr
needs_info: True

click here for bot help

@ansibot ansibot added the has_pr This issue has an associated PR. label Mar 11, 2020
@wirerydr
Copy link
Author

(Speaking as the originator of this bug report)

Something weird is going on - Ansibot seems to be expecting feedback from me, but I pulled the PR, tested it, and provided feedback (to this issue on this comment thread) nearly 3 months ago - Please refer to #65855 (comment).

Please let me know if anything further is required from me, and I will happily provide it.

WireRydr

@ansibot ansibot removed the needs_info This issue requires further information. Please answer any outstanding questions. label Mar 11, 2020
@ansibot ansibot added collection Related to Ansible Collections work collection:ansible.posix and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 29, 2020
@ansibot ansibot added needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. labels Apr 29, 2020
Akasurde pushed a commit to Akasurde/ansible.posix that referenced this issue May 29, 2020
…ansible#61752)"

This reverts part of ansible commit 72023d7.

The immediate reason is that it breaks mounts where src is not a path.
Examples of such mounts are network-based filesystems such as nfs, cifs,
glusterfs, ceph, virtual filesystems such as tmpfs or overlayfs, and
also UUID-based mounts. It is too hard to come with an exhaustive list,
especially if we take non-Linux systems into account, so don't even try.

Additionally, it did not really fix the issue (ansible/ansible#59183) that
it intended to fix, because the mount could fail but leave a non-working
fstab entry for reasons other than non-existing src path.

Fixes: ansible/ansible#65855
Fixes: ansible/ansible#67588
Fixes: ansible/ansible#67966
Akasurde pushed a commit to Akasurde/ansible.posix that referenced this issue May 29, 2020
…ansible#61752)"

This reverts part of ansible commit 72023d7.

The immediate reason is that it breaks mounts where src is not a path.
Examples of such mounts are network-based filesystems such as nfs, cifs,
glusterfs, ceph, virtual filesystems such as tmpfs or overlayfs, and
also UUID-based mounts. It is too hard to come with an exhaustive list,
especially if we take non-Linux systems into account, so don't even try.

Additionally, it did not really fix the issue (ansible/ansible#59183) that
it intended to fix, because the mount could fail but leave a non-working
fstab entry for reasons other than non-existing src path.

Restore fstab and remove the mount point after a failed mount

Add a reminder that not only devices can be mounted

Fixes: ansible/ansible#65855
Fixes: ansible/ansible#67588
Fixes: ansible/ansible#67966

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Akasurde pushed a commit to Akasurde/ansible.posix that referenced this issue May 29, 2020
…ansible#61752)"

This reverts part of ansible commit 72023d7.

The immediate reason is that it breaks mounts where src is not a path.
Examples of such mounts are network-based filesystems such as nfs, cifs,
glusterfs, ceph, virtual filesystems such as tmpfs or overlayfs, and
also UUID-based mounts. It is too hard to come with an exhaustive list,
especially if we take non-Linux systems into account, so don't even try.

Additionally, it did not really fix the issue (ansible/ansible#59183) that
it intended to fix, because the mount could fail but leave a non-working
fstab entry for reasons other than non-existing src path.

Restore fstab and remove the mount point after a failed mount

Add a reminder that not only devices can be mounted

Fixes: ansible/ansible#65855
Fixes: ansible/ansible#67588
Fixes: ansible/ansible#67966

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
maxamillion pushed a commit to ansible-collections/ansible.posix that referenced this issue May 29, 2020
…ansible#61752)" (#33)

This reverts part of ansible commit 72023d7.

The immediate reason is that it breaks mounts where src is not a path.
Examples of such mounts are network-based filesystems such as nfs, cifs,
glusterfs, ceph, virtual filesystems such as tmpfs or overlayfs, and
also UUID-based mounts. It is too hard to come with an exhaustive list,
especially if we take non-Linux systems into account, so don't even try.

Additionally, it did not really fix the issue (ansible/ansible#59183) that
it intended to fix, because the mount could fail but leave a non-working
fstab entry for reasons other than non-existing src path.

Restore fstab and remove the mount point after a failed mount

Add a reminder that not only devices can be mounted

Fixes: ansible/ansible#65855
Fixes: ansible/ansible#67588
Fixes: ansible/ansible#67966

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>

Co-authored-by: Alexander E. Patrakov <patrakov@gmail.com>
@ansible ansible locked and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. collection:ansible.posix collection Related to Ansible Collections work has_pr This issue has an associated PR. module This issue/PR relates to a module. needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. system System category
Projects
None yet
5 participants