Ohai custom plugin results not reported back to Chef server

I am experimenting with chef-client version
11.10.0.rc.1 on AIX 6.1.

I have written an Ohai 7 plugin and therefore upgraded Ohai on the AIX
box to version 7.0.4 (using gem install ohai). When running ohai from the
command line, the plugin works fine as expected.

I have added the ohai cookbook to the run_list of the AIX client node.
Executing a chef-client run from the command line does not produce any
warning nor error messages. However, the attributes collected by my custom
plugin do not show up in the node view on the Chef server webui nor are
they searchable from the command line using knife.

Are Ohai custom plugins supported by chef-client version 11.10.0.rc.1?

Is the problem I am seeing possibly caused by using Ohai 7 with chef-client
version 11.10.0.rc.1?

Where should I look for evidence what’s going wrong?

Thanks for any advice!

Reto

On Tuesday, May 27, 2014 at 5:48 AM, Reto Hermann wrote:

I am experimenting with chef-client version 11.10.0.rc.1 on AIX 6.1.

I have written an Ohai 7 plugin and therefore upgraded Ohai on the AIX box to version 7.0.4 (using gem install ohai). When running ohai from the command line, the plugin works fine as expected.

I have added the ohai cookbook to the run_list of the AIX client node. Executing a chef-client run from the command line does not produce any warning nor error messages. However, the attributes collected by my custom plugin do not show up in the node view on the Chef server webui nor are they searchable from the command line using knife.

Are Ohai custom plugins supported by chef-client version 11.10.0.rc.1?
Is the problem I am seeing possibly caused by using Ohai 7 with chef-client version 11.10.0.rc.1?
Where should I look for evidence what's going wrong?

Thanks for any advice!

Reto
Try running chef-client with -ldebug to see messages from ohai, and check if your plugin is actually running at all. It could be a configuration issue where your plugin is not getting picked up by ohai when chef-client runs, or it could be failing for some reason when chef-client runs the plugin (currently ohai’s design is to let plugins fail so that they don’t have to be defensively coded, but this makes it tricky to debug when a plugin that isn’t supposed to fail does fail).

--
Daniel DeLeo

Daniel -

Followed your advice.

While the plugin was executed, my clause
’if platform.eql?(“aix”) or platform_family.eql?(“aix”)'
prevented the execution of my code because I wrongly required ‘require_plugin(“platform_family)”’,
which is valid on ohai 7 but not on ohai 6, instead of ‘require_plugin(“platform)”’.
The wrong ‘require_plugin’ had no adverse effect when running ohai
from the command line whereas it did prevent my code from executing when
run as part of a chef-client run. Hence, my false conclusion that results
are not reported back.

Problem solved, thanks for your help!

Reto

From:
Daniel DeLeo <dan@kallistec.com>

To:
chef@lists.opscode.com

Date:
28.05.2014 23:54

Subject:
[chef] Re: Ohai
custom plugin results not reported back to Chef server

Sent by:
Daniel DeLeo
<ddeleo@kallistec.com>


On Tuesday, May 27, 2014 at 5:48 AM, Reto Hermann wrote:

> I am experimenting with chef-client version 11.10.0.rc.1 on AIX 6.1.

>

> I have written an Ohai 7 plugin and therefore upgraded Ohai on the
AIX box to version 7.0.4 (using gem install ohai). When running ohai from
the command line, the plugin works fine as expected.

>

> I have added the ohai cookbook to the run_list of the AIX client node.
Executing a chef-client run from the command line does not produce any
warning nor error messages. However, the attributes collected by my custom
plugin do not show up in the node view on the Chef server webui nor are
they searchable from the command line using knife.

>

> Are Ohai custom plugins supported by chef-client version 11.10.0.rc.1?

> Is the problem I am seeing possibly caused by using Ohai 7 with chef-client
version 11.10.0.rc.1?

> Where should I look for evidence what’s going wrong?

>

> Thanks for any advice!

>

> Reto

Try running chef-client with -ldebug to see messages from ohai, and check
if your plugin is actually running at all. It could be a configuration
issue where your plugin is not getting picked up by ohai when chef-client
runs, or it could be failing for some reason when chef-client runs the
plugin (currently ohai’s design is to let plugins fail so that they don’t
have to be defensively coded, but this makes it tricky to debug when a
plugin that isn’t supposed to fail does fail).

Daniel DeLeo