Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
设置一个测试厨房烹饪书配方,在vagrant中生成厨师服务器_Vagrant_Chef Infra_Vagrantfile_Test Kitchen - Fatal编程技术网

设置一个测试厨房烹饪书配方,在vagrant中生成厨师服务器

设置一个测试厨房烹饪书配方,在vagrant中生成厨师服务器,vagrant,chef-infra,vagrantfile,test-kitchen,Vagrant,Chef Infra,Vagrantfile,Test Kitchen,我正在用厨师和测试厨房做实验 我面临的问题如下。 我使用的是arch linux,无法在我的机器上安装chef,因此我决定使用centos7 box作为工作vm 我的目标是让EnterpriseChef服务器通过TestKitchen使用cookbook创建,并使两台机器(服务器和工作vm)在同一网络上可访问,一台机器依赖于另一台机器。是的,这是一个嵌套的设置。 如果有人有更好的想法,我愿意接受不同的建议 对于正在工作的vm,我使用了以下框: 这是我流浪汉档案的内容: Vagrant.conf

我正在用厨师和测试厨房做实验

我面临的问题如下。 我使用的是arch linux,无法在我的机器上安装chef,因此我决定使用centos7 box作为工作vm

我的目标是让EnterpriseChef服务器通过TestKitchen使用cookbook创建,并使两台机器(服务器和工作vm)在同一网络上可访问,一台机器依赖于另一台机器。是的,这是一个嵌套的设置。 如果有人有更好的想法,我愿意接受不同的建议

对于正在工作的vm,我使用了以下框:

这是我流浪汉档案的内容:

Vagrant.configure(2)do | config|
config.vm.box=“chef repo”
config.vm.network“公共_网络”
结束
所以基本的东西

我成功地在那台机器上安装了厨师和测试厨房,生活很好

现在的问题是使用test kitchen从这里安装chef server:

我使用test kitchen创建了一个非常简单的配置,如下所示:

recipes/default.rb

package_url=node['enterprise-chef']['url']
包名称=::File.basename(包url)
package_local_path=“#{Chef::Config[:file_cache_path]}/#{package_name}”
#omnibus_包是远程的(即URL),让我们下载它
远程\u文件包\u本地\u路径do
源程序包的url
结束
包本地路径
#重新配置安装
执行“私人厨师ctl重新配置”
…和
attributes/default.rb

default['enterprise-chef']['url']='https://web-dl.packagecloud.io/chef/stable/packages/el/7/chef-server-core-12.1.0-1.el7.x86_64.rpm'
之后,我运行了
$kitchen converge
,结果失败得很惨:

[vagrant@localhost enterprise-chef]$ kitchen converge
-----> Starting Kitchen (v1.4.0)
-----> Creating <default-centos-65>...
       Bringing machine 'default' up with 'virtualbox' provider...
       ==> default: Importing base box 'opscode-centos-6.5'...
==> default: Matching MAC address for NAT networking...
       ==> default: Setting the name of the VM: kitchen-enterprise-chef-default-centos-65_default_1436040993946_29931
       ==> default: Clearing any previously set network interfaces...
       ==> default: Available bridged network interfaces:
       1) eth0
       2) eth1
       ==> default: When choosing an interface, it is usually the one that is
       ==> default: being used to connect to the internet.
       Vagrant is attempting to interface with the UI in a way that requires
       a TTY. Most actions in Vagrant that require a TTY have configuration
       switches to disable this requirement. Please do that or run Vagrant
       with TTY.
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [Expected process to exit with [0], but received '1'
---- Begin output of vagrant up --no-provision --provider virtualbox ----
STDOUT: Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'opscode-centos-6.5'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: kitchen-enterprise-chef-default-centos-65_default_1436040993946_29931
==> default: Clearing any previously set network interfaces...
==> default: Available bridged network interfaces:
1) eth0
2) eth1
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
STDERR: Vagrant is attempting to interface with the UI in a way that requires
a TTY. Most actions in Vagrant that require a TTY have configuration
switches to disable this requirement. Please do that or run Vagrant
with TTY.
---- End output of vagrant up --no-provision --provider virtualbox ----
Ran vagrant up --no-provision --provider virtualbox returned 1]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

[vagrant@localhost enterprise-chef]$ 
到目前为止,我得到了以下错误:

[vagrant@localhost kitchen-enterprise-chef-default-centos-65]$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Available bridged network interfaces:
1) eth0
2) eth1
==> default: When choosing an interface, it is usually the one that is
==> default: being used to connect to the internet.
    default: Which interface should the network bridge to? 1
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: bridged
==> default: Forwarding ports...
    default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
^C==> default: Waiting for cleanup before exiting...
Vagrant exited after cleanup due to external interrupt.
$
默认值:警告:连接超时。重试…
无限期地进行,我被迫停止。 但这台机器似乎正在运行,只有第一个流浪者无法访问

[vagrant@localhost kitchen-enterprise-chef-default-centos-65]$ vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
[vagrant@localhost kitchen-enterprise-chef-default-centos-65]$ 
我的猜测是网络配置出了严重的问题

任何关于我的设置的想法或反馈都是非常受欢迎的


谢谢。

厨师长服务器烹饪手册已设置为运行测试厨房:

git clone https://github.com/chef-cookbooks/chef-server.git
cd chef-server
kitchen converge default-centos-71
它利用vagrant为chef服务器设置一个可运行的服务器。如果这在您的虚拟机(嵌套虚拟化)中起作用,那将非常有趣

另一种方法是利用cloud kitchen文件运行测试VM:


我建议您只使用chef zero provisioner for foodcritic

provisioner:
  name: chef_zero
  data_bags_path: /some/path
  ...

这将在主机箱上启动一个临时chef zero服务器,并使其可用于foodcritic运行。这也为您节省了运行第二台服务器的主要开销。我所知道的唯一挫折是,如果您碰巧需要同时测试多个节点。我不完全确定插件将如何处理这个问题。它要么共享一个Chef zero(可能是好的,也可能是坏的),要么为每个测试套件创建一个Chef zero(同样,好的或坏的,取决于您实际想要的),要么它可能只是崩溃。

似乎不起作用:。Digital ocean看起来很有趣,但我还是想在使用云计算之前让它在本地工作。在主机盒上使用chef zero而不是虚拟chef服务器有什么不对?这就是“零号厨师”的初衷。我想这是有道理的。谢谢如果您创建一个答案,我可以将该线程标记为已解决。