Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify cookbook path in .kitchen.yml file?

I have my Chef cookbooks stored in chef/cookbooks/ folder. When running kitchen converge I am still getting notice

Berksfile, Cheffile, cookbooks/, or metadata.rb not found so Chef will run with effectively no cookbooks. Is this intended?

I tried many options, for example:

suites:
  - name: default
    run_list: recipe[git]
    cookbook_path: "chef/cookbooks"

but I can't find the proper solution. How to specify the cookbooks' and roles' paths?

like image 752
tsusanka Avatar asked Apr 29 '14 14:04

tsusanka


People also ask

Where is Kitchen Yml located?

Finally, Test Kitchen also has several environment variables where you can set a path to a kitchen. yml or $HOME/. kitchen/config. yml file.

What is Kitchen Yml?

Kitchen is a testing framework provided by chef. kitchen. yml is a fairly simple file. Its purpose is to provide configurations for the kitchen setup.

What is Kitchen converge?

A converge will leave the machine running and kitchen automatically uploads changes each converge so that one can iterate rapidly on configuration code. A lot of time and effort has gone into ensuring that the exit code of kitchen is always appropriate.

What is Kitchen in chef?

Advertisements. Test Kitchen is Chef's integrated testing framework. It enables writing test recipes, which will run on the VMs once they are instantiated and converged using the cookbook. The test recipes run on that VM and can verify if everything works as expected.


2 Answers

You'll want to put the path in your berksfile, which will likely end up looking like so..

source 'https://supermarket.chef.io'
cookbook 'cookbookname', path: 'relative/or/absolute/path/to/cookbook/directory'

The berksfile is also used by chef when you deploy your code so it helps if your relative file structure is the same on your machine as it is on your chef server (i.e. all cookbooks share a directory so your berksfile can use the path '../cookbookname')

like image 124
JackChance Avatar answered Oct 12 '22 01:10

JackChance


You want to set it in the provisioner section:

provisioner:
  name: chef_zero
  require_chef_omnibus: 11.12.2
  cookbook_path: whatever/path/to/cookbooks
like image 29
sethvargo Avatar answered Oct 12 '22 01:10

sethvargo