[chef] Template's "cookbook" attribute being ignored


Chronological Thread 
  • From: Jonathan Matthews < >
  • To: chef < >
  • Subject: [chef] Template's "cookbook" attribute being ignored
  • Date: Mon, 4 Apr 2011 21:55:31 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=jpluscplusm.com; s=google; h=mime-version:sender:x-originating-ip:date:x-google-sender-auth :message-id:subject:from:to:content-type; b=f5W7ZuQdlH14OCcBapD6syMer8HnuEwWgnlT5/4HGULE736TzDgRF4QSyvWnF4aYCK Q8v6WAK2XkLdYT1JLCpxwpNOpHQ5OFUfD3T5uKjKx+QoRqTdWWbQwWp4m9EX2RuXoIOP xZ4gyYwqCwGDKQfTLcKbfkL26eEW63ogBfPZY=

I'm running 0.9.12 on Ubuntu Lucid (server) and Debian Squeeze (client).

The client appears to be ignoring the "cookbook" attribute set inside
a template definition.

Here's the code from the recipe inside my "filesystem" cookbook (much
code redacted and irrelevant, given logs, below).  The behaviour is
the same, regardless of which "cookbook" line is commented out:

tmpl_cookbook = config["cookbook"] || "templates"
# code redacted here
log("FS:TMPL: cookbook  == #{tmpl_cookbook}") { level :debug }
# NO code redacted here
template name do
  action tmpl_action
  cookbook "templates"
  #cookbook tmpl_cookbook
  path tmpl_path
  source config["source"]
  group config["group"]
  mode config["mode"]
  owner config["owner"]
  local config["local"] if config["local"]
  variables( auto_vars.merge(vars) )
end

The debug logs show the following, regardless of which line (above) is
commented and which is active. Both show the client "looking for
template etc-default-tftpd-hpa.erb in cookbook "filesystem"", which is
where the code is *defined*:

[Mon, 04 Apr 2011 21:42:29 +0100] DEBUG: FS:TMPL: path      ==
/etc/default/tftpd-hpa
[Mon, 04 Apr 2011 21:42:29 +0100] DEBUG: Processing log[FS:TMPL:
cookbook  == templates] on boot00
[Mon, 04 Apr 2011 21:42:29 +0100] DEBUG: FS:TMPL: cookbook  == templates
[Mon, 04 Apr 2011 21:42:29 +0100] DEBUG: Processing
template[tftpd-hpa_defaults] on boot00.nix.sys.7digital.net
[Mon, 04 Apr 2011 21:42:29 +0100] DEBUG: looking for template
etc-default-tftpd-hpa.erb in cookbook "filesystem"
[Mon, 04 Apr 2011 21:42:29 +0100] DEBUG: Not storing
cookbooks/templates/templates/default/etc-default-tftpd-hpa.er
<etc>

What am I missing? I've tried directly setting the cookbook, and via a
variable, so I don't think I'm hitting the same issue that Charles
Duffy described in "param[:name] bizarreness when nesting defines"
(Jan 19th).  Again, it's 0.9.12 on ubuntu+debian.

Jonathan
-- 
Jonathan Matthews
London, UK
http://www.jpluscplusm.com/contact.html



Archive powered by MHonArc 2.6.16.

§