From 3f3b8f6a1b34a99730ec843901b7eac2eb029aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20So=CC=88derberg?= Date: Tue, 23 Aug 2016 22:14:12 +0200 Subject: [PATCH 1/2] Reload systemd unit file on changes If one changes for example the `ulimit` value it won't be picked up on the next restart of Kafka as `systemd` won't know about it. See #110. --- recipes/_service.rb | 8 ++++++++ spec/recipes/configure_spec.rb | 5 +++++ test/integration/systemd/serverspec/service_spec.rb | 4 ---- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/recipes/_service.rb b/recipes/_service.rb index 06240488..091ac605 100644 --- a/recipes/_service.rb +++ b/recipes/_service.rb @@ -30,9 +30,17 @@ helper :controlled_shutdown_enabled? do !!fetch_broker_attribute(:controlled, :shutdown, :enable) end + if kafka_init_style == :systemd + notifies :run, 'execute[kafka systemctl daemon-reload]', :immediately + end if restart_on_configuration_change? notifies :create, 'ruby_block[coordinate-kafka-start]', :immediately end end +execute 'kafka systemctl daemon-reload' do + command 'systemctl daemon-reload' + action :nothing +end if kafka_init_style == :systemd + include_recipe node['kafka']['start_coordination']['recipe'] diff --git a/spec/recipes/configure_spec.rb b/spec/recipes/configure_spec.rb index ebe59e24..eb1cf339 100644 --- a/spec/recipes/configure_spec.rb +++ b/spec/recipes/configure_spec.rb @@ -459,6 +459,11 @@ 'systemd/default.erb' end + it 'reloads unit files' do + expect(chef_run.execute('kafka systemctl daemon-reload')).to do_nothing + expect(chef_run.template(init_path)).to notify('execute[kafka systemctl daemon-reload]').to(:run).immediately + end + context 'and platform is \'debian\'' do it_behaves_like 'an init style' do let :platform_and_version do diff --git a/test/integration/systemd/serverspec/service_spec.rb b/test/integration/systemd/serverspec/service_spec.rb index 008da180..bfe37f84 100644 --- a/test/integration/systemd/serverspec/service_spec.rb +++ b/test/integration/systemd/serverspec/service_spec.rb @@ -18,10 +18,6 @@ 'systemctl status kafka.service' end - before :all do - run_command 'systemctl daemon-reload' - end - before do run_command 'systemctl reset-failed kafka.service' end From 6b5fe3dae3af4325273f689b91d8dbbe610dbfee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20S=C3=B6derberg?= Date: Wed, 24 Aug 2016 20:22:25 +0200 Subject: [PATCH 2/2] Work around issue in newest Vagrant Don't really know about this at all... --- vagrantfiles/cachier.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/vagrantfiles/cachier.rb b/vagrantfiles/cachier.rb index b197d7ae..45041c58 100644 --- a/vagrantfiles/cachier.rb +++ b/vagrantfiles/cachier.rb @@ -1,4 +1,5 @@ Vagrant.configure('2') do |c| + c.ssh.insert_key = false if Vagrant.has_plugin?('vagrant-cachier') c.cache.auto_detect = true c.cache.scope = :box