Specifying which cookbooks to run with Chef Solo

后端 未结 5 676
孤城傲影
孤城傲影 2021-01-31 11:05

I\'m using chef-solo to test my cookbooks locally, but I want to be able to only run the cookbook(s) that I\'m testing. Currently, it seems like chef-solo will run all cookbooks

5条回答
  •  不思量自难忘°
    2021-01-31 11:39

    Sadly, I don't think there is. Chef runs in a two-pass mode: first, it parses and builds a model of your cookbooks (the "compile" phase), and then it runs only those cookbooks that you specify in the run list. I believe it does this to make sure it catches the dependencies between cookbooks in the compile phase. The compile phase has to be consistent or else it errors out.

    To really understand this, look at the ruby block resource. Any ruby that's floating around in your recipes will be evaluated at compile time; any ruby you want to run at evaluation time has to be placed in a ruby block resource. Once you grok that, the nature of the two-pass evaluation becomes apparent.

    I think your only options are to bring in your cookbooks one at a time, like you are doing, or to fix your attributes.

提交回复
热议问题