1

我想使用 test-kitchen 来部署带有 java 和 hadoop 食谱的 ubuntu。我已经用测试厨房安装了 1 个套件。

我在厨房配置文件中放了另一个套件,现在厨房坏了。

我撤消了对厨房配置文件的更改,但厨房仍然损坏。

当我做一个

  kitchen list

我收到以下错误

/home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/instance.rb:209:in `last_action': undefined method `[]' for false:FalseClass (NoMethodError)
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/command/list.rb:53:in `display_instance'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/command/list.rb:73:in `block in list_table'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/command/list.rb:73:in `map'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/command/list.rb:73:in `list_table'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/command/list.rb:38:in `call'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/cli.rb:47:in `perform'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/cli.rb:81:in `list'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/cli.rb:233:in `invoke_task'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/bin/kitchen:13:in `block in <top (required)>'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/lib/kitchen/errors.rb:81:in `with_friendly_errors'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/gems/test-kitchen-1.2.1/bin/kitchen:13:in `<top (required)>'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/bin/kitchen:23:in `load'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/bin/kitchen:23:in `<main>'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/bin/ruby_executable_hooks:15:in `eval'
from /home/anupam/.rvm/gems/ruby-2.0.0-p451@chef/bin/ruby_executable_hooks:15:in `<main>'

而且我不知道错误消息的含义。

当我尝试创建/销毁/收敛/登录时,我也会收到类似的错误消息。


编辑:添加 .kitchen.yml

driver:
 name: vagrant

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-12.04
    driver_config:
      network:
      - ["private_network", {ip: "192.168.56.103"}]
      customize:
        memory: 512
  # - name: centos-6.4
  # - name: centos-6.4-i386
  #   # driver_config:
  #   #   network:
  #   #   - ["private_network", {ip: "192.168.56.103"}]
  #   #   customize:
  #   #     memory: 512
  # - name: fedora-20-i386

suites:
  - name: default
    run_list:
      - recipe[odin-solr::default]
    attributes:
  # - name: default-2
  #   run_list:
  #     - recipe[odin-solr::default]
  #   attributes:
4

2 回答 2

4

您的评论中有一个未完成的 YAML 密钥:

# <snip>
suites:
  - name: default
    run_list:
      - recipe[odin-solr::default]
    attributes: # <== here
  # - name: default-2
  #   run_list:
  #     - recipe[odin-solr::default]
  #   attributes:
于 2014-03-27T17:35:03.553 回答
2

此错误源于kitchen list糟糕的 YAML 令人窒息。它可以发生在文件中.kitchen.yml.kitchen/*.yml文件中(用于在 .kitchen 文件中存储 VM 的状态)。可能的修复:

  1. 确保您没有任何悬空哈希键,例如在这些位置中的任何一个

    run_list:
      - recipe[thing::default]       
    attributes: 
      # having no keys here is invalid.
    
  2. 删除.kitchen/*.yml文件。再次运行kitchen list将重建它们(不必重新配置机器)

于 2014-05-20T21:05:59.830 回答