[chef] Reload attributes file


Chronological Thread 
  • From: Joe Lind < >
  • To:
  • Subject: [chef] Reload attributes file
  • Date: Fri, 17 Feb 2012 10:18:19 -0600

Hi,

I'm attempting to make one of my attributes files a little bit more dynamic based on an attribute set in another cookbook::recipe. On the very first chef-client run on a node this doesn't work since the value hasn't been set yet.  I understand why it doesn't work because of the compile/execute phases, but thought I had seen a previous mail that provided a workaround but not able to find it in the archives. 

Basically, I'd like to have the yum attributes file re-executed when the yum cookbook is run so it would then have the value for node.chef.mrepo_url.  
Any help would be appreciated. 

node run_list:  "recipe[chef]", "reciipe[yum]"

Chef cookbook recipe (the mrepo url is generated since it is different for each environment):
   ...
   node.set.chef.mrepo_url = "https://#{node['chef']['my_chef_server']}/mrepo
   ...

In the yum cookbook attributes file:
  node['yum']['redhat5.5']['base_url'] = node[:chef'][:mrepo_url].to_s + '/RHServer5.5-x86_64/RPMS.all'


Thanks,
Joe





  • [chef] Reload attributes file, Joe Lind, 02/17/2012

Archive powered by MHonArc 2.6.16.

§