2017-04-24 56 views
0

这里是我的kitchen.yml我们可以在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的运行列表属性中使用角色吗?

+0

厨师服务器并不重要,因为您使用的是本地配置器,但您将测试角色放在了什么路径? – coderanger

+0

json文件(tomcat.json)位于test/integration/roles文件夹下'roles_path:test/integration/roles /'更新文章。 – aaj

+0

是否有任何特定的位置我应该保留我的json文件? – aaj

回答

1

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

+0

我试过了。我的json文件名是'tomcatrole',json中的名称字段也是'tomcatrole',在kitchen.yml中我也有'tomcatrole' run_list: - “role [tomcatrole]” – aaj

0

好,所以问题是roles_paths。我将其更改为role_path并且一切正常。

+0

如果这对你有用,接受它作为答案。 – Pred

相关问题