include_recipe 不适用于测试厨房

include_recipe does not work with test-kitchen

我有两本食谱 "users" 和 "nginx"。第一本说明书为系统创建用户和文件夹,第二本说明书为创建的目录配置安装 nginx。

在 kitchen.yml 文件中,我将 "users:default" 添加到 运行 列表:

---
driver:
  name: vagrant

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-14.04

suites:
  - name: default
    run_list:
      - recipe[users::default]
      - recipe[nginx::default]

并且在 nginx::default 食谱中我添加了 include_recipe:

include_recipe "users::default"

但不包括 "users::default" when i 运行 "kitchen converge":

Installing Cookbook Gems:
       Compiling Cookbooks...
       Converging 8 resources
       Recipe: nginx::default
         * apt_package[curl] action install
           - install version 7.35.0-1ubuntu2.6 of package curl
         * apt_package[git-core] action install
           - install version 1:1.9.1-1ubuntu0.3 of package git-core
         * apt_package[nginx] action install

有什么问题?为什么我不能 运行 "users::default" 另一本食谱中的食谱?

include_recipe 只会 运行 一个给定的食谱一次,所以它不能同时出现在 运行 列表中和通过 include_recipe 运行 .它仍然应该出现在输出中,pastebin 你的 users/recipes/default.rb?

当我在 berksfile 中使用路径时,它已解决:

source 'https://supermarket.chef.io'

metadata

cookbook "users", path: "../../cookbooks/users"
cookbook "swap", path: "../../cookbooks/swap"

这意味着,在给定路径中使用用户说明书,而不是使用源 url