1
votes

I am looking for specific instructions on how to override default values in a third party cookbook. For example, i am using apache_spark cookbook (https://github.com/clearstorydata-cookbooks/apache_spark)

And i want to override the attribute default['apache_spark']['standalone']['master_host']

I tried it my making a main recipe, in which i add node.default['apache_spark']['standalone']['master_host'] = 'foo.com'

And execute it using chef solo like:

run_list(
  'recipe[main]',
  'recipe[apache_spark::spark-standalone-worker]'
)

But that does not seem to work. Any suggestions on how it needs to be done? My main recipe is here https://github.com/Vibhuti/chef-main

1
Your main::default recipe seems to be empty and the cookbook has no attributes/ directory. Is that right?zuazo
Actually they are empty thats why i guess git did not upload them.Vibhuti

1 Answers

6
votes

The correct fix would be to make a wrapper cookbook and set your values in the cookbook's attributes file (main/attributes/default.rb):

override['apache_spark']['standalone']['master_host'] = 'foo.com'

Also make sure you add a dependency in main's metadata.rb to force the load ordering to be correct:

depends 'apache_spark'