[chef] Re: weird empty attributes


Chronological Thread 
  • From: Max Gorbul < >
  • To:
  • Subject: [chef] Re: weird empty attributes
  • Date: Fri, 10 Feb 2012 10:22:47 -0800

which version of json gem you have installed on the nodes where chef-client fails ?

--max

On Fri, Feb 10, 2012 at 12:55 AM, Tomoyuki Sakurai < "> > wrote:
hi,

i'm investigating an weird problem. our recipe works well, most of time.

say, you have a base recipe with some basic attributes. other recipe
include_attribute the recipe and create new default attributes.

in common/attributes/default.rb

case node[:platform]
when "freebsd"
 default.common[:etc_dir] = "/usr/local/etc"
else
 default.common[:etc_dir] = "/etc"
end

in other_recipe/attributes/default.rb

include_attributes "common"

default.other_recipe[:config_dir] = "#{node[:common][:etc_dir]}/myconfig_dir"

this works as expected, most of time. the problem is, it fails
sometimes on different nodes. when it failed, failed-run-data.json
contains something like:

...
 "default": {
   "other_recipe": {
     "config_fir": "/myconfig_dir",
     ...
   }
 }
...

this means node[:common][:etc_dir] is empty. interestingly,
node[:common][:etc_dir] is defined properly in failed-run-data.json;
it is "/usr/local/etc".

when it failed, I usually ssh to the node, run chef-client manually
and it succeeds.

this is very hard to reproduce as it happens randomly on some
nodes. at least, when you restart chef-client daemon, everything
is okay for a while. if you don't restart it, chef-run keeps
failing.

does anyone know where to look at?

--
Tomoyuki Sakurai




Archive powered by MHonArc 2.6.16.

§