我们可以在kitchen.yml中添加一个角色吗?

时间:2017-04-24 10:48:17

标签: chef test-kitchen

这是我的kitchen.yml

---
driver:
  name: vagrant
  network:
    - ["private_network", {ip: "192.168.35.35"}]

provisioner:
  name: chef_zero
  # You may wish to disable always updating cookbooks in CI or other testing environments.
  # For example:
  #   always_update_cookbooks: <%= !ENV['CI'] %>
  always_update_cookbooks: true
  roles_path: test/integration/roles/

verifier:
  name: inspec

platforms:
  - name: ubuntu-14.04

suites:
  - name: default
    run_list:
      - role[tomcat_role]
    verifier:
      inspec_tests:
        - test/smoke/default
    attributes:

我一直收到以下错误

    [2017-04-24T10:39:02+00:00] ERROR: Role tomcat_role (included by 'top lev
el') is in the runlist but does not exist. Skipping expand.

       =========================================================================
=======
       Error expanding the run_list:
       =========================================================================
=======

       Missing Role(s) in Run List:
       ----------------------------
       * tomcat_role included by 'top level'

角色肯定在厨师服务器上,但我仍然收到此错误。我们不允许在kitchen.yml的运行列表属性中使用角色吗?

2 个答案:

答案 0 :(得分:2)

如评论中所述,角色的文件名必须与其name字段匹配,并且必须与运行列表中的role[name]字符串匹配。确保所有这三个对齐,你应该全部设置。

答案 1 :(得分:1)

好的问题是 func userPickedValue(value : YourDataype) { // Do something with received value } 。我将其更改为roles_paths,一切正常。