厨师独奏在厨房测试期间找不到菜谱 [英] Chef solo can't find cookbook during kitchen test run

查看:126
本文介绍了厨师独奏在厨房测试期间找不到菜谱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为一堆用于配置Jenkins CI实例的食谱添加一个测试厨房。

I'm trying to add a Test Kitchen for a bunch of cookbooks that we use to provision a Jenkins CI instance.

我们使用Berkshelf来管理依赖项。文件结构如下:

We use Berkshelf to manage dependencies. The file structure is as follows:

|   .gitignore
|   .kitchen.yml
|   Berksfile
|   Berksfile.lock
|   bootstrap.sh
|   chefignore
|   metadata.rb
|   provision.sh
|   readme.md
|   solo.json
|   solo.rb
|   tree.txt
|   VERSION
|   
+---.kitchen
|   |   default-ubuntu-1404.yml
|   |   
|   +---kitchen-vagrant
|   |   \---kitchen-chef-jenkins-default-ubuntu-1404
|   |       |   Vagrantfile
|   |       |   
|   |       \---.vagrant
|   |           \---machines
|   |               \---default
|   |                   \---virtualbox
|   |                           action_set_name
|   |                           id
|   |                           index_uuid
|   |                           private_key
|   |                           synced_folders
|   |                           
|   \---logs
|           default-centos-71.log
|           default-ubuntu-1404.log
|           kitchen.log
|           
+---site-cookbooks
|   +---ant
|   |   |   .gitignore
|   |   |   .kitchen.yml
|   |   |   Berksfile
|   |   |   CHANGELOG.md
|   |   |   chefignore
|   |   |   CONTRIBUTING.md
|   |   |   LICENSE
|   |   |   metadata.rb
|   |   |   README.md
|   |   |   TESTING.md
|   |   |   Thorfile
|   |   |   
|   |   +---attributes
|   |   |       default.rb
|   |   |       
|   |   +---providers
|   |   |       library.rb
|   |   |       
|   |   +---recipes
|   |   |       default.rb
|   |   |       install_package.rb
|   |   |       install_source.rb
|   |   |       
|   |   +---resources
|   |   |       library.rb
|   |   |       
|   |   \---templates
|   |       \---default
|   |               ant_home.sh.erb
|   |               
|   +---haxe_cookbook
|   |   |   CHANGELOG.md
|   |   |   metadata.rb
|   |   |   README.md
|   |   |   
|   |   \---recipes
|   |           default.rb
|   |           
|   \---mbp-jenkins
|       |   Berksfile
|       |   Berksfile.lock
|       |   CHANGELOG.md
|       |   chefignore
|       |   metadata.rb
|       |   README.md
|       |   
|       +---recipes
|       |       default.rb
|       |       
|       +---resources
|       |   |   commons-net-3.3.jar
|       |   |   
|       |   +---css
|       |   |       style.css
|       |   |       
|       |   +---images
|       |   |       logo-mbp.png
|       |   |       web.png
|       |   |       
|       |   \---js
|       |           scripts.js
|       |           
|       \---templates
|           +---default
|           |   |   config.xml
|           |   |   
|           |   \---secrets
|           |           hudson.console.AnnotatedLargeText.consoleAnnotator
|           |           hudson.model.Job.serverCookie
|           |           hudson.util.Secret
|           |           jenkins.security.ApiTokenProperty.seed
|           |           jenkins.slaves.JnlpSlaveAgentProtocol.secret
|           |           master.key
|           |           org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices.mac
|           |           org.jenkinsci.main.modules.instance_identity.InstanceIdentity.KEY
|           |           
|           \---emails
|                   build-complete.html.groovy
|                   build-started.html.groovy
|                   
\---test
    \---integration
        \---default

执行中:

kitchen converge default-ubuntu-1404

导致以下错误:

    [2015-08-24T09:13:24+00:00] ERROR: Cookbook mbp-jenkins not found. If you're loading mbp-jenkins from another cookbook, make sure you configure the dependency in your metadata
[2015-08-24T09:13:24+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

这表明Chef-solo找不到食谱mbp-jenkins。我希望它能在我们按如下方式在solo.rb文件中定义菜谱路径时找到它:

Which suggests that chef-solo can't find the cookbook mbp-jenkins. I would expect it to find it though as we define the cookbook paths in the solo.rb file as follows:

root = File.absolute_path(File.dirname(__FILE__))

file_cache_path 'cache'
cookbook_path [root + "/cookbooks", root + "/site-cookbooks",root + "/berks-cookbooks"]

不太确定这里出了什么问题,所以任何建议都应该感谢

Not really sure what is going wrong here so any suggestions would be appreciated

更新:

我尝试使用厨师零配置程序,但是却给了我输出:

I have tried using the chef zero provisioner, that however gives me the output:

================================================================================
Error Resolving Cookbooks for Run List:
================================================================================

Missing Cookbooks:
------------------
No such cookbook: mbp-jenkins

Expanded Run List:
------------------
* mbp-jenkins::default


推荐答案

您是否尝试过使用Chef_zero预配器?我怀疑您的问题是因为厨师solo没有运行Berkshelf,这可以解释丢失的菜谱。

Have you tried using the chef_zero provisioner instead? I suspect your problem is because chef solo does not run Berkshelf, which would explain the missing cookbooks.

例如,请参阅:

如何在Chef中自定义tomcat食谱

问题似乎是site-cookbooks目录中的烹饪书是不能复制到目标计算机。

The issue appears to be that the cookbooks in the site-cookbooks directory is not be copied over to the target machine.

对我来说,最简单,最好的解决方法是在Berksfile中包含本地食谱,如下所示:

Seems to me the simplest and best fix is to include the local cookbooks in your Berksfile as follows:

source 'https://supermarket.chef.io'

cookbook 'ant',           path: 'site-cookbooks/ant'
cookbook 'haxe_cookbook', path: 'site-cookbooks/haxe_cookbook'
cookbook 'mbp-jenkins',   path: 'site-cookbooks/mbp-jenkins'

metadata

这篇关于厨师独奏在厨房测试期间找不到菜谱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆