From 830deac2e61b4e0b7a14590cb5b8d976839ffbe8 Mon Sep 17 00:00:00 2001 From: "Julian C. Dunn" Date: Mon, 2 Feb 2015 07:55:21 +0100 Subject: [PATCH] Fix the ordering of the logrotate attributes. These have to be set *after* the init_style is determined. Add a config suite to .kitchen.yml so this can be validated. --- .kitchen.yml | 5 +++++ attributes/default.rb | 16 +++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.kitchen.yml b/.kitchen.yml index 4c79c4b7..62b36392 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -56,6 +56,11 @@ suites: - recipe[chef-client::cron] attributes: {} +- name: config + run_list: + - recipe[chef-client::config] + attributes: {} + - name: delete_validation run_list: - recipe[chef-client::delete_validation] diff --git a/attributes/default.rb b/attributes/default.rb index f31e9278..e1d59dcf 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -38,13 +38,6 @@ # log_file has no effect when using runit default['chef_client']['log_file'] = 'client.log' -default['chef_client']['log_rotation']['options'] = ['compress'] -default['chef_client']['log_rotation']['postrotate'] = case node['chef_client']['init_style'] - when 'systemd' - 'systemctl reload chef-client.service >/dev/null || :' - else - '/etc/init.d/chef-client reload >/dev/null || :' - end default['chef_client']['interval'] = '1800' default['chef_client']['splay'] = '300' default['chef_client']['conf_dir'] = '/etc/chef' @@ -172,3 +165,12 @@ default['chef_client']['cache_path'] = '/var/chef/cache' default['chef_client']['backup_path'] = '/var/chef/backup' end + +# Must appear after init_style to take effect correctly +default['chef_client']['log_rotation']['options'] = ['compress'] +default['chef_client']['log_rotation']['postrotate'] = case node['chef_client']['init_style'] + when 'systemd' + 'systemctl reload chef-client.service >/dev/null || :' + else + '/etc/init.d/chef-client reload >/dev/null || :' + end