Override Attributes With The Wrapper Cookbook

I just started using Chef and want to install Hadoop on my node. So far I have this very simple recipe that doesn't work.

my-hadoop/attributes/default.rb:

    default['hadoop']['core_site']['fs.defaultFS'] = "Test"


my-hadoop/recipes/default.rb:

    include_recipe "hadoop"

hadoop_cookbook/attributes/default.rb:

    default['hadoop']['core_site']['fs.defaultFS'] = "hdfs://#{node['fqdn']}"

      

This was my understanding of cookbook wrappers after reading some blog posts. It installs Hadoop, but the default is used every time. Changing the default for any other priority such as "override" does not resolve the issue.

EDIT: The node list is just 'recipe [slave]':

slave/recipes/default:

    include_recipe "my-hadoop"

      

+3


source to share


1 answer


Chef 11 requires metadata.rb

dependencies to be installed in your file . include_recipe

really only includes the recipe file, so the chef needs some hints as to what order to download the required cookbooks.

Your cookbook slave

will depend on my-hadoop

. Then it my-hadoop

will depend onhadoop_cookbook

File slave/metadata.rb

:
depends "my-hadoop", "~> 1.5"

      



File my-hadoop/metadata.rb

:
depends "hadoop_cookbook", "~> 1.3"

      

If you've set the default attribute in the cookbook slave

, I believe it just worked.

0


source







All Articles