[chef] Re: Data-Bag how to use in templates


Chronological Thread 
  • From: Charles Duffy < >
  • To:
  • Subject: [chef] Re: Data-Bag how to use in templates
  • Date: Wed, 23 Mar 2011 02:43:23 -0500

A symbol cannot have a period within its name without being quoted; consequently, the ".at", instead of being considered part of the symbol, is being parsed as the name of a method to call on the symbol itself. (Also, it's unusual to make a symbol's name all-uppercase -- they're special constants by definition, they don't need any kind of capitalization).

Frankly, this looks to me like a case where you want a string, anyhow:

node[:global]["ntp_2_thalesgroup.at"]

would be more usual, and also would work.

On Wed, Mar 23, 2011 at 2:21 AM, WEINHAPL Andreas < "> > wrote:

HI,

 

Yesterday I tested the Data-Bag! But I’m not able to use the Information from the DataBag in Templates.

My recipe is:

GLOBAL = data_bag_item('GLOBAL', 'NTP') and just use a template-function (create a file from file.erb)

 

In my file.erb:

<%= node[:GLOBAL][:ntp_2_thalesgroup.at] %>

 

But If I start a chef-client I will get this problem:

Chef::Mixin::Template::TemplateError (undefined method `at' for :ntp_2_thalesgroup:Symbol) on line #3:

 

Could anybody help me please?!

 

Regards

Andreas





Archive powered by MHonArc 2.6.16.

§