How do I use roles in test kitchen?

陌路散爱 提交于 2019-12-24 06:51:09

问题


I can't figure out how to run roles in a run list in test kitchen.

I did a knife download roles to my chef repo (C:\.chef\roles).

I also did a knife download cookbooks to c:\.chef\cookbooks

Here is the .kitchen.yml for a cookbook I want to test which I plan to run with a particular role (C:\.chef\cookbooks\mybook\.kitchen.yml):

---
driver:
  name: hyperv
  parent_vhd_folder: c:\HyperV\VHDs\
  parent_vhd_name: 2012R2_Fresh_Gen1.vhdx
  vm_switch: NAT
  memory_startup_bytes: 2GB

provisioner:
  name: chef_zero
  roles_path: c:\.chef\roles

transport:
  password: pass123

platforms:
  - name: windows-2012r2

suites:
  - name: default
    run_list:
      - role[myrole]
    attributes:

When I run a kitchen converge I get "No such cookbook:" error for cookbooks that are in that role.

How do I get test kitchen to find those cookbooks? I tried adding a - cookbooks line to my .kitchen.yml with the path of all the necessary cookbooks I have on my workstation, but this did not work- I also think I should be doing this with berkshelf instead?


回答1:


You'll need to tell Test Kitchen where to get your cookbooks. The easiest way to do this is Berkshelf (or maybe a Policyfile). Put a Berksfile next to the Kitchen config and show it where to get all the cookbooks (supermarket, local paths, chef server, etc).



来源:https://stackoverflow.com/questions/38647035/how-do-i-use-roles-in-test-kitchen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!