0

我无法弄清楚如何让我的食谱与厨房 ci 正确运行。这是我编写并执行的:

厨房.yml

driver:
  name: docker
  binary: docker
  use_sudo: false

provisioner:
  name: chef_zero
  always_update_cookbooks: true
  chef_repo_path: ../..
  nodes: ../../nodes

platforms:
  - name: ubuntu-16.04
    driver_plugin: docker

suites:
  - name: default
    data_bags_path: "../../data_bags"
    encrypted_data_bag_secret_key_path: "../../data_bags/secrets/bitbucket.json"
    run_list:
            - recipe[redmine_test]

verifier:
  name: inspec

Berksfile 在我的食谱文件夹中:

source 'https://supermarket.chef.io'
metadata
cookbook 'nginx', '~> 2.7.6'
cookbook 'logrotate', '~> 1.9.2'

我运行的命令:

$ berks vendor
$ kitchen create && kitchen converge -l debug

This is the error I get:
 ================================================================================
       Recipe Compile Error in /tmp/kitchen/cache/cookbooks/redmine_test/recipes/default.rb
       ================================================================================

       NoMethodError
       -------------
       undefined method `[]' for nil:NilClass

       Cookbook Trace:
       ---------------
         /tmp/kitchen/cache/cookbooks/redmine_test/recipes/default.rb:73:in `block in from_file'
         /tmp/kitchen/cache/cookbooks/redmine_test/recipes/default.rb:70:in `from_file'

       Relevant File Content:
       ----------------------
       /tmp/kitchen/cache/cookbooks/redmine_test/recipes/default.rb:

        66:      action :add
        67:    end
        68:  end
        69:  
        70:  directory "redmine_repos" do
        71:    path lazy { "#{node['etc']['passwd'][node['redmine']['user']]['dir']}/repos" }
        72:    owner node['redmine']['user']
        73>>   group node['nginx']['group']
        74:    mode 02775
        75:  end
        76:  

我怎么会得到这个错误?而 group node['nginx']['group'] 变量在已售出的 nginx 食谱中得到了很好的定义。

谢谢

4

1 回答 1

0

nginx食谱必须是depends nginx您的 metadata.rb 的一部分 ( )。或者它必须在你的 run_list 上。

还有,2.7.6很老了,7.x已经有了。

于 2018-01-18T18:53:24.010 回答