Hey Chris,Thanks Cary, before I changed to compile phase, the code was like this and showed the same problem.
I am not sure how well performing the run-resource-in-compile-phase works
with LWRP -- I'm personnally never tried it.
Specifically...
h = rs_utils_hostname "set_system_hostname" do
short_hostname node['rs_utils']['short_hostname']
domain_name node['rs_utils']['domain_name']
action :nothing
end
h.run_action(:set)
I am not seeing any of the resources in the LWRP being processed (execpt
ohai -- for some reason). I am not sure that it is necessary to do this
trick. I suggest just trying in the converge phase.
Specifically...
rs_utils_hostname "set_system_hostname" do
short_hostname node['rs_utils']['short_hostname']
domain_name node['rs_utils']['domain_name']
action :set
end
Hope that helps! (but I have my doubts)
-CP
On Wed, Jun 6, 2012 at 8:39 PM, Chris Fordham
< >
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<https://github.com/flaccid/cookbooks_public/blob/master/cookbooks/rs_utils/recipes/setup_hostname.rb>
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.
Archive powered by MHonArc 2.6.16.