Jira (FACT-1519) mountpoints fact does not show mounts on nfs

3 views
Skip to first unread message

Andrey Khomyakov (JIRA)

unread,
Oct 19, 2016, 5:00:07 PM10/19/16
to puppe...@googlegroups.com
Andrey Khomyakov created an issue
 
Facter / Bug FACT-1519
mountpoints fact does not show mounts on nfs
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2016/10/19 1:59 PM
Environment:

debian jessie and centos 72 show this behavior

Priority: Normal Normal
Reporter: Andrey Khomyakov

I expect the mountpoints fact to return all mounts not just those mapped to physical devices.
https://docs.puppet.com/facter/latest/core_facts.html#mountpoints

Set mount point using mount resource:
mount

{ "userhome": name => "/home", device => "nfshost:/homedirs", fstype => "nfs", ensure => "mounted", options => "defaults", atboot => true, remounts => true, }

~# mount | grep home
nfshost:/homedirs on /home type nfs (rw,relatime,vers=3,rsize=65536,wsize=65536,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.10.10.10,mountvers=3,mountport=4046,mountproto=udp,local_lock=none,addr=10.10.10.10)

~# facter mountpoints | grep home

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.14#64029-sha1:ae256fe)
Atlassian logo

Tim Purkerson (JIRA)

unread,
Apr 3, 2017, 2:00:02 PM4/3/17
to puppe...@googlegroups.com
Tim Purkerson updated an issue
Change By: Tim Purkerson
Attachment: network_mountpoint_fact.py.bz2

Branan Riley (JIRA)

unread,
May 30, 2017, 10:38:03 AM5/30/17
to puppe...@googlegroups.com
Branan Riley updated an issue
 
Facter / Improvement FACT-1519
Change By: Branan Riley
Issue Type: Bug Improvement

Branan Riley (JIRA)

unread,
May 30, 2017, 10:38:03 AM5/30/17
to puppe...@googlegroups.com

Branan Riley (JIRA)

unread,
Mar 21, 2018, 6:42:04 PM3/21/18
to puppe...@googlegroups.com
Branan Riley updated an issue
Change By: Branan Riley
Labels: linux triaged
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Branan Riley (JIRA)

unread,
Mar 21, 2018, 6:42:04 PM3/21/18
to puppe...@googlegroups.com

Thomas Hufschmidt (JIRA)

unread,
May 29, 2018, 7:09:02 AM5/29/18
to puppe...@googlegroups.com
Thomas Hufschmidt commented on Improvement FACT-1519
 
Re: mountpoints fact does not show mounts on nfs

I know is is quite old, but I recently stumbled upon this myself after switching from my custom mounts fact to the "new" facter mounpoints facts.

This is a really annoying behaviour, that seems to be related to this issue:
https://tickets.puppetlabs.com/browse/FACT-1482

Thomas Hufschmidt (JIRA)

unread,
May 29, 2018, 7:10:02 AM5/29/18
to puppe...@googlegroups.com
Thomas Hufschmidt updated an issue
 
Change By: Thomas Hufschmidt
Affects Version/s: FACT 3.6.10

Andrey Khomyakov (JIRA)

unread,
May 29, 2018, 9:57:02 AM5/29/18
to puppe...@googlegroups.com
Andrey Khomyakov commented on Improvement FACT-1519
 
Re: mountpoints fact does not show mounts on nfs

I am no coder, but the issue was there and I just wrote a custom fact to solve the problem at hand a few days after I opened this bug.

 

# nfs_mountpoints.rb
Facter.add('nfs_mountpoints') do
    setcode do
        # Define nfs_mountpoints as hash
        nfs_mountpoints = {}
        # Execute shell command with timeout to prevent hung puppet agent
        begin
            # List all mounted volumes with FS time NFS. Multiple mounts will show up on different lines. \n is end of line and splits string into array.
            # Iterate through the list of mounted NFS volumes taking the index of array entry
            Facter::Core::Execution.execute('/bin/mount | /bin/grep nfs', :timeout => 5).split("\n").each do |nfs_mountpoint_entry|
                # Initialize temporary hash variable to build a sub hash for our final reply
                nfs_mountpoint_entry_hash = {}
                # Pick out interesting info from the array
                # Each entry is a string containing nfs target, local volume name, FS type and options. Split array at "space"
                nfs_mountpoint_entry_hash['device'] = nfs_mountpoint_entry.split(" ")[0]
                nfs_mountpoint_entry_hash['filesystem'] = nfs_mountpoint_entry.split(" ")[4]
                # Save it into our reply variable using volume name as hash key
                nfs_mountpoints[nfs_mountpoint_entry.split(" ")[2]] = nfs_mountpoint_entry_hash
            end
        rescue Facter::Core::Execution::ExecutionFailure
            'timeout!'
        end
        # Return final result as a fact
        nfs_mountpoints
    end
end

 

 It's probably gross, but it returns needed info so I'm using it.

Roland Synnestvedt (Jira)

unread,
Oct 27, 2020, 5:33:02 PM10/27/20
to puppe...@googlegroups.com

Created: 2016/10/19 1:59 PM
Linux: use the setmntent function to retrieve the mount points.

This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Roland Synnestvedt (Jira)

unread,
Oct 27, 2020, 5:41:03 PM10/27/20
to puppe...@googlegroups.com
Roland Synnestvedt updated an issue
 
Change By: Roland Synnestvedt
Comment: According to [Puppet Docs|https://puppet.com/docs/puppet/6.19/core_facts.html#mountpoints] facter mountpoints on Linux uses "the setmntent function to retrieve the mount points."

setmntent is [deprecated from LSB |https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/baselib-setmntent-3.html#FTN.AEN8983]

This issue of facter mountpoints not showing NFS or SMB mounts, is still an issue 4 years after initial report :(
Reply all
Reply to author
Forward
0 new messages