0

Is there a way to keep both the Berksfile and the Policyfile in a chef cookbook and a way to control which dependency management engine to use during chef run?

blueowl
  • 35
  • 6
  • Why do you want to do that? – Draco Ater Jun 18 '20 at 06:45
  • I am asking about the possibility. If there are cookbooks which uses a berksfile for their dependency management and I need to use them in a cookbook which uses a Policyfile, I run into issues where the dependent cookbooks doesn't fetch the right version and on explicitly mentioning the versions in the metadata.rb, I run into the circular dependency error. – blueowl Jun 18 '20 at 08:25
  • Cookbooks do not use anything for their dependency management. The just state the dependencies in `metadata.rb`. It's up to user to select either Policy or Berks for the dependency management. Probably you should make your question more specific. What cookbook and dependency management system you are using and what error do you get on downloading dependencies. – Draco Ater Jul 08 '20 at 07:27
  • In the `metadata.rb` file can one state both Policy and Berks and still get the cookbook running successfully is my question. – blueowl Jul 15 '20 at 14:10
  • You can't state in `metadata.rb` neither Policy nor Berks. – Draco Ater Jul 17 '20 at 06:14
  • Okay in that case I got my answer. You cannot use both Policyfile and berks together. – blueowl Jul 21 '20 at 11:33
  • 1
    You can use them together, but it isn't useful. If you have circular deps that molinillo does not solve you can't try to use berks to remove that and still be able to use a policyfile. The correct answer to your problem is to remove your circular dependencies, then just use policyfiles. – lamont Jul 23 '20 at 21:09
  • the circular dependencies are from external cookbooks which is used as dependencies in the cookbook that I am trying to include. Resolving circular dependencies is like getting in contact with the author of those cookbooks because of which circular dependencies is being created. Thank you @lamont, even I thought Policyfile is the way to go forward. – blueowl Jul 27 '20 at 11:14
  • 1
    I'm strongly considering changing the ability of Berkshelf to fail hard on any circular dependency to force people to fix these problems to be compatible with Molinillo. Circular deps are definitively wrong. Molinillo correctly will never support them. The more they block people from upgrading to Policyfiles and produce the wrong behavior, the more inclined I am to break support for them hard in order to settle the question and get people to fix their code the right way. Circular deps are a bug that must be fixed. Feel free to point those cookbook authors at this. – lamont Jul 30 '20 at 19:34

0 Answers0