I am trying to configure chef-client to output logs to a file in a test kitchen run, but my configuration in .kitchen.yml
doesn't appear to be being reflected in the client.rb
prepared and injected into the test node.
I'm using ChefDK 0.3.6, the chef_zero provisioner and vagrant driver over virtualbox.
An extract from my .kitchen.yml
file:
...
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"
...
Another extract, this from the output of 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"
...
And finally, the contents of /tmp/kitchen/client.rb
on the test node:
[root@TRSTWPRTSTAPV99 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"
As you can see, the expected log_location
entry is not being included in the client.rb
, which I guess is the reason why no log file is being created in the specified path.
Could you please help me understand how to correctly enable logging to a file through chef-client in kitchen?
References used so far:
client.rb
reference: https://docs.chef.io/config_rb_client.html- chef-client specific settings in
.kitchen.yml
: https://docs.chef.io/config_yml_kitchen.html#chef-client-specific-settings