[chef] How to set an attribute inside a cookbook?


Chronological Thread 
  • From: Anthony Kong < >
  • To:
  • Subject: [chef] How to set an attribute inside a cookbook?
  • Date: Mon, 16 Feb 2015 08:04:07 +1100

Hi,

I want to set an attribute in another cookbook otherwise it will fail during 'kitchen converge'

       Chef::Exceptions::ValidationFailed
       ----------------------------------
       Required argument password is missing!

        23:
        24:  # Set password according to attribute, if set
        25:  mysqld_password 'root' do
        26>>   password node['mysqld']['root_password']

I have tried these 

node['mysqld']['root_password'] = 'password'

and 

node.default['mysqld']['root_password'] = 'password'

before this line

include_recipe "mysqld"

But apparently it has no effect.

What is the proper way to set a variable of a included cookbook?



Archive powered by MHonArc 2.6.16.

§