0

While execution of recipes I need to use an external dependency. I see 2 choices to work it out:

  • Using include_recipe inside of my recipes. In this case user might be caught by surprise because of extra packages installed (or having them installed in a different way than the one he intended).
  • Declaring it as dependency, but leaving it to user-code to install it. In this case user won't be able to use my cookbook right away and will be forced to include it in run_list explicitly.

Any opinions on this? When it comes to other dependency-management systems like Maven, it's okay for dependency to have its own (transitive) dependency, but user can always override its version or exclude it so he has control over all transitive dependencies. Not sure about this in Chef.

1 Answers1

0

It depends on the particular situation. If you state it clearly in the README and have good reasons, then you can leave it up to the user of your cookbook to add the dependency in a wrapper cookbook or role.

However, for most situations I would expect that all dependencies are declared in metadata.rb and prerequisites are installed by the application cookbook. This makes it easier to run a cookbook with the help of Berkshelf and Test-Kitchen.

StephenKing
  • 952
  • 1
  • 8
  • 18