2

致力于评估厨师。与测试厨房一起工作。

**** 注意 -- Linux 和 Chef 新手 ****

我正在使用 CentOS 7。安装了 chefdk 0.7.0。由于我的沙盒中的一些 Websense 限制,我只是打算建立 2 个 VM 并使用 kitchen-ssh 驱动程序。

所以我跑了kitchen-init --driver=kitchen-ssh --create-gemfile(根据这个链接: http: //misheska.com/blog/2014/09/21/survey-of-test-kitchen-providers/#physical-machine-drivers)。此命令及其输出没有问题。

我跑bundle install了没有问题。

.kitchen.yml这样更新了我的文件:

---
driver:
  name: ssh

provisioner:
  name: chef_solo

platforms:
  - name: centos7
    driver:
      hostname: 10.226.70.31
      username: xxxxxxxxxx
      password: xxxxxxxxxx

suites:
  - name: default
    run_list:
    attributes:

我跑了kitchen list,得到以下错误:

    kitchen list
    >>>>>> ------Exception-------
    >>>>>> Class: Kitchen::ClientError
    >>>>>> Message: Could not load the 'ssh' driver from the load path. Please ensure that your driver is installed as a gem or included in your Gemfile if using Bundler.
    >>>>>> ----------------------
    >>>>>> Please see .kitchen/logs/kitchen.log for more details
    >>>>>> Also try running `kitchen diagnose --all` for configuration

    cat .kitchen/logs/kitchen.log
    E, [2015-09-15T16:48:11.630689 #30421] ERROR -- Kitchen: ------Exception-------
    E, [2015-09-15T16:48:11.630833 #30421] ERROR -- Kitchen: Class: Kitchen::ClientError
    E, [2015-09-15T16:48:11.630894 #30421] ERROR -- Kitchen: Message: Could not load the 'ssh' driver from the load path. Please ensure that your driver is installed as a gem or included in your Gemfile if using Bundler.
    E, [2015-09-15T16:48:11.630936 #30421] ERROR -- Kitchen: ---Nested Exception---
    E, [2015-09-15T16:48:11.630974 #30421] ERROR -- Kitchen: Class: LoadError
    E, [2015-09-15T16:48:11.631009 #30421] ERROR -- Kitchen: Message: cannot load such file -- kitchen/driver/ssh
    E, [2015-09-15T16:48:11.631045 #30421] ERROR -- Kitchen: ------Backtrace-------
    E, [2015-09-15T16:48:11.631148 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/driver.rb:50:in `rescue in for_plugin'
    E, [2015-09-15T16:48:11.631195 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/driver.rb:40:in `for_plugin'
    E, [2015-09-15T16:48:11.631233 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/config.rb:226:in `new_driver'
    E, [2015-09-15T16:48:11.631299 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/config.rb:239:in `new_instance'
    E, [2015-09-15T16:48:11.631340 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/config.rb:135:in `block in build_instances'
    E, [2015-09-15T16:48:11.631376 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/config.rb:134:in `map'
    E, [2015-09-15T16:48:11.631412 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/config.rb:134:in `with_index'
    E, [2015-09-15T16:48:11.631448 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/config.rb:134:in `build_instances'
    E, [2015-09-15T16:48:11.631484 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/config.rb:110:in `instances'
    E, [2015-09-15T16:48:11.631520 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/command.rb:115:in `filtered_instances'
    E, [2015-09-15T16:48:11.631557 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/command.rb:145:in `parse_subcommand'
    E, [2015-09-15T16:48:11.631594 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/command/list.rb:32:in `call'
    E, [2015-09-15T16:48:11.631630 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/cli.rb:56:in `perform'
    E, [2015-09-15T16:48:11.631667 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/cli.rb:108:in `list'
    E, [2015-09-15T16:48:11.631703 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
    E, [2015-09-15T16:48:11.631739 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
    E, [2015-09-15T16:48:11.631775 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/cli.rb:308:in `invoke_task'
    E, [2015-09-15T16:48:11.631811 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
    E, [2015-09-15T16:48:11.631847 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
    E, [2015-09-15T16:48:11.631914 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/bin/kitchen:13:in `block in <top (required)>'
    E, [2015-09-15T16:48:11.631976 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/lib/kitchen/errors.rb:154:in `with_friendly_errors'
    E, [2015-09-15T16:48:11.632032 #30421] ERROR -- Kitchen: /opt/chefdk/embedded/apps/test-kitchen/bin/kitchen:13:in `<top (required)>'
    E, [2015-09-15T16:48:11.632098 #30421] ERROR -- Kitchen: /usr/bin/kitchen:15:in `load'
    E, [2015-09-15T16:48:11.632141 #30421] ERROR -- Kitchen: /usr/bin/kitchen:15:in `<main>'
    E, [2015-09-15T16:48:11.632204 #30421] ERROR -- Kitchen: ----------------------

我跑来gem list验证是否安装了所需的 gem

gem list

*** LOCAL GEMS ***

bigdecimal (1.2.0)
bundler (1.10.6)
CFPropertyList (2.3.1)
i18n (0.7.0)
io-console (0.4.2)
json (1.7.7)
kitchen-ssh (0.0.8)
kitchen-vagrant (0.18.0)
minitar (0.5.4)
mixlib-shellout (2.2.1)
net-scp (1.2.1)
net-ssh (2.9.2)
psych (2.0.0)
rake (10.4.2)
rdoc (4.0.0)
safe_yaml (1.0.4)
test-kitchen (1.4.2)
thor (0.19.1)

我已经了解了与此相关的各种文件的所有途径,并且不知道为什么它无法找到“ssh”驱动程序。

任何帮助将不胜感激

4

1 回答 1

3

我已经确定了这个问题。当我运行任何gem <command>命令时,我并没有在它们前面加上厨师,以便利用厨房将试图利用的厨师嵌入式宝石。

所以当我运行 chef gem list 时,我发现 kitchen-ssh 没有列出。现在由于我必须在沙盒中处理的 Websense/SSL 问题,我必须从本地文件下载并安装 gem:

chef gem install --local ~/kitchen-ssh-0.0.8.gem

注意我确实收到了这些消息:

    WARNING:  You don't have /root/.chefdk/gem/ruby/2.1.0/bin in your PATH,
              gem executables will not run.
    Successfully installed kitchen-ssh-0.0.8
    WARNING:  Unable to pull data from 'https://rubygems.org/': SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
    1 gem installed

第二个WARNING与 Websense/SSL 试验有关,因此其他人很可能不会发生这种情况。

但是它似乎安装得很好。

我现在能够使用我正在尝试的厨房命令,并通过 SSH 成功连接到我的测试厨房盒子。

希望这对尝试此操作的其他人有益。干杯

于 2015-09-16T14:48:02.240 回答