You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I have a mounted nfs filesystem, I run chef-client / ohai discovery and I want to get a list of the filesystems. The issue is that for the mounted nfs filesystem, I got two entries for it under filesystem attributes. They are almost the same, except they have different "key" -- one is ending with "/" and another is not, as below example
remote_host:/test_export
remote_host:/test_export/
Steps to Reproduce:
create a nfs export on one server, e.g. exporting /test_export on "remote_host"
mount it on a second server
run chef-client or ohai on the second server and check the discovery result
Expected Result:
If I run chef-client, I should see an entry -- "filesystem"->"remote_host:/test_export" on Chef server, with proper attributes under it.
Actual Result:
Two entries are seen, with keys of
remote_host:/test_export
remote_host:/test_export/
Root cause:
After reading the plugin code, I believe this a defect in filesystem plugin (ohai-xxxx/lib/ohai/linux/filesystem.rb). The last part of it is to "grab any missing mount information from /proc/mounts". In /proc/mounts, the filesystem name ends with "/", e.g.
remote_host:/test_export/ /test_mount nfs4 rw,relatime,vers=4,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.114.222.16,minorversion=0,local_lock=none,addr=10.114.222.16 0 0
While commands like df and mount will give the name without the last "/". This leads to the duplicated entries.
The text was updated successfully, but these errors were encountered:
Do you, by chance, have the NFS mounts in /etc/fstab with a trailing "/", or do you mount them with a trailing "/"? If so, you will get this behavior. The fastest way to correct this would be to drop trailing "/" from your mounts.
Version:
Ohai: 8.0.1
Chef: 12.0.3 (chef-client)
Environment:
CentOS 6.6
Scenario:
When I have a mounted nfs filesystem, I run chef-client / ohai discovery and I want to get a list of the filesystems. The issue is that for the mounted nfs filesystem, I got two entries for it under filesystem attributes. They are almost the same, except they have different "key" -- one is ending with "/" and another is not, as below example
remote_host:/test_export
remote_host:/test_export/
Steps to Reproduce:
Expected Result:
If I run chef-client, I should see an entry -- "filesystem"->"remote_host:/test_export" on Chef server, with proper attributes under it.
Actual Result:
Two entries are seen, with keys of
remote_host:/test_export
remote_host:/test_export/
Root cause:
After reading the plugin code, I believe this a defect in filesystem plugin (ohai-xxxx/lib/ohai/linux/filesystem.rb). The last part of it is to "grab any missing mount information from /proc/mounts". In /proc/mounts, the filesystem name ends with "/", e.g.
remote_host:/test_export/ /test_mount nfs4 rw,relatime,vers=4,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,port=0,timeo=600,retrans=2,sec=sys,clientaddr=10.114.222.16,minorversion=0,local_lock=none,addr=10.114.222.16 0 0
While commands like df and mount will give the name without the last "/". This leads to the duplicated entries.
The text was updated successfully, but these errors were encountered: