Bug in ohai aix filesystem plugin


#1

Hello,

filesystem attribute not present on certain AIX nodes. Versions : AIX 7.2 with chef-13.2.20-1.powerpc.bff

It seems to be when a nfs filesystem is mounted.

So I tried to debug.
ohai filesystem -l debug returns:

[2017-10-19T14:13:14+02:00] DEBUG: Running Ohai with the following configuration: {:log_location=>#<IO:<STDERR>>, :log_level=>:debug, :invoked_from_cli=>true}
[2017-10-19T14:13:14+02:00] DEBUG: Searching for Ohai plugins in /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/plugins  
[...]
[2017-10-19T14:13:14+02:00] DEBUG: Plugin Filesystem: ran 'mount' and returned 0
[2017-10-19T14:13:14+02:00] DEBUG: Plugin Filesystem: ran 'df -Pk' and returned 0
[2017-10-19T14:13:14+02:00] DEBUG: Plugin Filesystem threw #<NoMethodError: undefined method `split' for nil:NilClass>
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/plugins/aix/filesystem.rb:64:in `block in parse_df_or_mount'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/plugins/aix/filesystem.rb:28:in `each'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/plugins/aix/filesystem.rb:28:in `parse_df_or_mount'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/plugins/aix/filesystem.rb:71:in `collect_old_version'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/plugins/aix/filesystem.rb:88:in `block (2 levels) in <main>'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/dsl/plugin/versionvii.rb:88:in `instance_eval'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/dsl/plugin/versionvii.rb:88:in `run_plugin'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/dsl/plugin.rb:100:in `run'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/dsl/plugin.rb:183:in `safe_run'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/runner.rb:84:in `run_v7_plugin'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/runner.rb:43:in `run_plugin'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/system.rb:104:in `block in run_plugins'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/system.rb:103:in `each'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/system.rb:103:in `run_plugins'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/system.rb:81:in `all_plugins'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/application.rb:93:in `run_application'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/application.rb:78:in `run'
[2017-10-19T14:13:14+02:00] DEBUG: /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/bin/ohai:41:in `<top (required)>'
[2017-10-19T14:13:14+02:00] DEBUG: /usr/bin/ohai:27:in `load'
[2017-10-19T14:13:14+02:00] DEBUG: /usr/bin/ohai:27:in `<main>'
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/system.rb:211:in `attributes_print': I cannot find an attribute named filesystem! (ArgumentError)
        from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/application.rb:97:in `block in run_application'
        from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/application.rb:96:in `each'
        from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/application.rb:96:in `run_application'
        from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/application.rb:78:in `run'
        from /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/bin/ohai:41:in `<top (required)>'
        from /usr/bin/ohai:27:in `load'
        from /usr/bin/ohai:27:in `<main>'

The problem seems to be that the last line returned by mount is not compliant with /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/ohai-13.2.0/lib/ohai/plugins/aix/filesystem.rb line 64 :

root@chefnode:/tmp/:>mount
  node       mounted        mounted over    vfs       date        options
-------- ---------------  ---------------  ------ ------------ ---------------
         /dev/hd4         /                jfs2   Feb 12 18:18 rw,log=/dev/hd8
[...]
nfsservr /export/nfs      /mnt              nfs3   Oct 10 16:23

oldie[key][:mount_options] = fields[7].split(",")

How should I manage this issue ?


#2

Please file an issue with exactly this data at https://github.com/chef/ohai/issues/new


#3

Hello Tom,

Thanks. Here is the issue :
https://github.com/chef/ohai/issues/1078