我试图配置厨师客户端在测试厨房运行中将日志输出到文件,但我的配置在.kitchen.yml
似乎没有反映在client.rb
准备好并注入到测试节点中。如何在厨房运行中将厨师 - 客户端日志输出捕获到文件中?
我使用ChefDK 0.3.6,chef_zero provisioner和vagrant driver over virtualbox。
从我.kitchen.yml
文件的摘录:
...
provisioner:
name: chef_zero
...
- name: install-only
run_list:
- recipe[my_cookbook::test_recipe]
attributes:
chef_client:
config:
log_location: "/var/log/chef/chef-client.log"
...
另一种提取物,这从kitchen diagnose
输出:
...
provisioner:
attributes:
chef_client:
config:
log_location: "/var/log/chef/chef-client.log"
chef_client_path: "/opt/chef/bin/chef-client"
chef_omnibus_install_options:
chef_omnibus_root: "/opt/chef"
...
最后的/tmp/kitchen/client.rb
测试节点上的内容:
[[email protected] log]# cat /tmp/kitchen/client.rb
node_name "install-only-rhel65-x86-64"
checksum_path "/tmp/kitchen/checksums"
file_cache_path "/tmp/kitchen/cache"
file_backup_path "/tmp/kitchen/backup"
cookbook_path ["/tmp/kitchen/cookbooks", "/tmp/kitchen/site-cookbooks"]
data_bag_path "/tmp/kitchen/data_bags"
environment_path "/tmp/kitchen/environments"
node_path "/tmp/kitchen/nodes"
role_path "/tmp/kitchen/roles"
client_path "/tmp/kitchen/clients"
user_path "/tmp/kitchen/users"
validation_key "/tmp/kitchen/validation.pem"
client_key "/tmp/kitchen/client.pem"
chef_server_url "http://127.0.0.1:8889"
encrypted_data_bag_secret "/tmp/kitchen/encrypted_data_bag_secret"
正如你所看到的,预期的log_location
条目未被包含在client.rb
中,我猜是没有在指定路径中创建日志文件的原因。
您能否帮我理解如何通过厨房中的厨师客户端正确启用日志记录到文件?
参考使用至今:
client.rb
参考:https://docs.chef.io/config_rb_client.html- 厨师客户机专用设置在
.kitchen.yml
:https://docs.chef.io/config_yml_kitchen.html#chef-client-specific-settings
你在运行列表中包含chef_client cookbook吗? IIRC提到的属性是由'chef_client :: config'配方使用的。 (我可能错了,因为我没有使用测试厨房) – Tensibai 2015-03-25 13:05:22
@Tensibai作为提供者(chef_zero)自带的我没有在我的runlist中包含'chef_client :: config'。这是嵌入在配置程序中的厨师客户端,我正在尝试配置日志记录功能。 – 2015-03-25 14:23:02