0

我们正在使用测试厨房来测试我们的厨师食谱。

在厨房容器内运行 chef-client 时,我看到了这个错误:

[2020-03-21T07:22:21+00:00] WARN: *****************************************
[2020-03-21T07:22:21+00:00] WARN: Did not find config file: /etc/chef/client.rb, using command line options.
[2020-03-21T07:22:21+00:00] WARN: *****************************************
Starting Chef Client, version 14.2.0

Running handlers:
[2020-03-21T07:22:23+00:00] ERROR: Running exception handlers
Running handlers complete
[2020-03-21T07:22:23+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 01 seconds
[2020-03-21T07:22:23+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2020-03-21T07:22:23+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2020-03-21T07:22:23+00:00] FATAL: Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/chef/chef_guid

我已经跑了

$ kitchen create
$ kitchen converge

在主机上。

在厨房 VM 上,目录 /etc/chef 不存在。

[root@kitchen-test ~]# ls /etc/chef
ls: cannot access /etc/chef: No such file or directory

我正在尝试以跟踪日志级别模式运行 chef-client,因为厨房收敛没有跟踪日志记录。Kitchen Converge 仅支持调试级别。

版本:

Test Kitchen version 2.3.3 (on host) with dokken driver
Chef: 14.2.0 (in kitchen vm)
4

1 回答 1

0

我有一个 hacky 方法可以在厨房客户端节点上以跟踪模式运行 chef-client。

厨房融合正在运行时,将 /opt/kitchen 中的文件备份到安全的地方。我选择 /tmp

rync -av /opt/kitchen /tmp/

通过执行 ^C 或让它完成来杀死厨房收敛。

/opt/kitchen 的结构应该类似于:

[root@node kitchen]# ls -a /tmp/kitchen/
.  ..  cache  chef_guid  client.pem  client.rb  clients  cookbooks  data_bags  dna.json  encrypted_data_bag_secret  environments  nodes  ohai  validation.pem

现在运行 chef-zero

# /opt/chef/embedded/bin/ruby /opt/chef/embedded/lib/ruby/gems/2.5.0/gems/chef-zero-14.0.6/bin/chef-zero &
(# /opt/chef/embedded/bin/chef-zero & might work too)

将所有内容上传到厨师零服务器

# cd /opt/kitchen
# /opt/chef/embedded/bin/knife upload . --chef-zero-host localhost --chef-zero-port 1 -c client.rb -V

现在以跟踪模式运行 chef-client

# /opt/chef/embedded/bin/chef-client -z -l trace -F doc -c /opt/kitchen/client.rb -j /opt/kitchen/dna.json
于 2020-03-22T19:31:38.317 回答