【问题标题】:include_recipe does not work with test-kitcheninclude_recipe 不适用于测试厨房
【发布时间】:2016-08-28 08:05:12
【问题描述】:

我有两本食谱“用户”和“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"

但是当我运行“厨房收敛”时它不包括“用户::默认”:

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”食谱?

【问题讨论】:

    标签: chef-infra test-kitchen


    【解决方案1】:

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

    source 'https://supermarket.chef.io'
    
    metadata
    
    cookbook "users", path: "../../cookbooks/users"
    cookbook "swap", path: "../../cookbooks/swap"
    

    这意味着,在给定的路径中使用用户手册,而不是使用源 URL

    【讨论】:

      【解决方案2】:

      include_recipe 只会运行给定的配方一次,因此它不能直接在运行列表中并通过include_recipe 运行。不过,它仍应显示在输出中,将您的 users/recipes/default.rb 粘贴到?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-15
        相关资源
        最近更新 更多