Mike and Daniel, thanks for the responses, and that makes sense about the attributes files. I did try logging from my cookbook's recipes/default.rb file, but my environment attribute was being evaluated as an empty string.For example, with this in my environment's JSON file:"default_attributes": {"my_attr": "/my/path"},Then if I put this in my attributes/default.rb file:default['my_cookbook']['cookbook_dir'] = "#{node[: my_attr]}/some/directory"And then log it like this in my recipes/default.rb:Chef::Log.info(node[:my_attr])Chef::Log.info(node['my_cookbook']['cookbook_dir'])Then it logs:INFO: /my/pathINFO: /some/directoryAnd not:INFO: /my/pathINFO: /my/path/some/directoryWhich is what I want. I would guess I'm just not using the proper syntax to define my attribute? But I've tried it with everything I can think of, and it's fine if I have to explicitly load the environment until Chef 11 :)Thanks!/~sOn Wed, Dec 26, 2012 at 11:09 AM, Mike < " target="_blank"> > wrote:Ok, what he said. :)
On Wed, Dec 26, 2012 at 11:07 AM, Daniel DeLeo < " target="_blank"> > wrote:
>
> On Wednesday, December 26, 2012 at 8:00 AM, Mike wrote:
>
> Hi Steven,
>
> You've placed your debugging code in the attributes/default.rb file,
> this gets evaluated at compile time.
>
> Have you tried placing the same debugging code in the
> recipes/default.rb (or somewhere like that) where the debugging
> statement will show what the value of an attribute is at the execution
> phase?
>
> -Mike
>
> A slightly longer explanation:
>
> Attributes from roles and environments are not applied to the node until
> after attributes files have all been evaluated. In Chef 11, this has been
> changed and you will be able to use role/environment attributes in
> attributes files.
>
>
> --
> Daniel DeLeo
>
Archive powered by MHonArc 2.6.16.