本文介绍了如何在测试厨房中使用角色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何在测试厨房的运行列表中运行角色.

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

我对厨师仓库(C:\.chef\roles)做了knife download roles.

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

我还对c:\.chef\cookbooks做了knife download cookbooks

这是我要测试的菜谱的.kitchen.yml,我打算测试该菜谱以特定角色运行(C:\.chef\cookbooks\mybook\.kitchen.yml):

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.

我如何获得测试厨房来查找那些食谱?我尝试在.kitchen.yml中添加- cookbooks行,其中包含我工作站上所有必需食谱的路径,但这行不通-我还认为我应该使用berkshelf来代替?

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?

推荐答案

您需要告诉Test Kitchen在哪里获取烹饪书.最简单的方法是Berkshelf(或一个Policyfile).在厨房"配置旁边放置一个Berksfile,并在其中显示获取所有食谱(超市,本地路径,厨师服务器等)的位置.

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).

这篇关于如何在测试厨房中使用角色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 03:17