Ohai resource with reload action doesn't refresh node etc


#1

Hello,

I do hope this is ok for this list as it seems to be core chef, although I
don’t discount the pebkac possibility.

This is the recipe which has a provider:

Example output showing that reloading ohai hostname plugin doesn’t
actually reload:

[Wed, 21 Sep 2011 00:04:46 +1000] INFO: Processing
ohai[reload_hostname_info_from_ohai] action reload
(/usr/src/chef-cookbooks/cookbooks_public/cookbooks/rs_utils/providers/hostname.rb
line 109)
[Wed, 21 Sep 2011 00:04:46 +1000] INFO:
ohai[reload_hostname_info_from_ohai] reloaded
[Wed, 21 Sep 2011 00:04:46 +1000] INFO: Processing
ruby_block[show_host_info] action create (rs_utils::setup_hostname line 36)
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: == New host/node information ==
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Hostname: fibbles.dev.xhost.net.au
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Network node hostname:
fibbles.dev.xhost.net.au
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Alias names of host: fibbles
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Short host name (cut from first
dot of hostname): fibbles
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Domain of hostname:
dev.xhost.net.au
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: FQDN of host:
fibbles.dev.xhost.net.au
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: IP addresses for the hostname:
10.0.0.3
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Current Chef FQDN loaded from
Ohai: localhost.localdomain
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: ruby_block[show_host_info] called
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Chef Run complete in 5.3113 seconds
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Running report handlers
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Report handlers complete

As you can see the hostname successfully changed and
ohai[reload_hostname_info_from_ohai] reloaded ran. But node[‘fqdn’] and
node[‘hostname’] are not updated: Current Chef FQDN loaded from Ohai:
localhost.localdomain (the old value). This is also the case if I added
another recipe to the run_list after - node[‘fqdn’] is still the old one.

We’ve tried many different ways of loading and ordering, each with the
same result: the ohai reload happens clearly before the log entries or
subsequent recipes, but not changed.

Is this a bug, pebkac or otherwise? Help is much appreciated and I can
lodge a bug if thats the case.

Best regards,

Chris Fordham
RightScale Inc.


#2

On Thu, 07 Jun 2012 13:39:17 +1000, Chris Fordham chris@xhost.com.au
wrote:

Hello,

I do hope this is ok for this list as it seems to be core chef, although
I don’t discount the pebkac possibility.

This is the recipe which has a provider:
https://github.com/flaccid/cookbooks_public/blob/master/cookbooks/rs_utils/recipes/setup_hostname.rb
Also here is the provider:
https://github.com/flaccid/cookbooks_public/blob/master/cookbooks/rs_utils/providers/hostname.rb
Maybe there is a way to debug if nobody has any ideas? Failing that I
think I will need to raise a bug - I’m just not seeing how the code is
wrong if the reload is occurring visibly early enough.

Example output showing that reloading ohai hostname plugin doesn’t
actually reload:

[Wed, 21 Sep 2011 00:04:46 +1000] INFO: Processing
ohai[reload_hostname_info_from_ohai] action reload
(/usr/src/chef-cookbooks/cookbooks_public/cookbooks/rs_utils/providers/hostname.rb
line 109)
[Wed, 21 Sep 2011 00:04:46 +1000] INFO:
ohai[reload_hostname_info_from_ohai] reloaded
[Wed, 21 Sep 2011 00:04:46 +1000] INFO: Processing
ruby_block[show_host_info] action create (rs_utils::setup_hostname line
36)
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: == New host/node information ==
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Hostname:
fibbles.dev.xhost.net.au
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Network node hostname:
fibbles.dev.xhost.net.au
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Alias names of host: fibbles
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Short host name (cut from first
dot of hostname): fibbles
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Domain of hostname:
dev.xhost.net.au
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: FQDN of host:
fibbles.dev.xhost.net.au
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: IP addresses for the hostname:
10.0.0.3
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Current Chef FQDN loaded from
Ohai: localhost.localdomain
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: ruby_block[show_host_info] called
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Chef Run complete in 5.3113
seconds
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Running report handlers
[Wed, 21 Sep 2011 00:04:47 +1000] INFO: Report handlers complete

As you can see the hostname successfully changed and
ohai[reload_hostname_info_from_ohai] reloaded ran. But node[‘fqdn’] and
node[‘hostname’] are not updated: Current Chef FQDN loaded from Ohai:
localhost.localdomain (the old value). This is also the case if I added
another recipe to the run_list after - node[‘fqdn’] is still the old one.

We’ve tried many different ways of loading and ordering, each with the
same result: the ohai reload happens clearly before the log entries or
subsequent recipes, but not changed.

Is this a bug, pebkac or otherwise? Help is much appreciated and I can
lodge a bug if thats the case.

Best regards,

Chris Fordham
RightScale Inc.