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 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