From cc9571d795b3ca36b2a9aa3fa8cf47d983a984e6 Mon Sep 17 00:00:00 2001 From: manegron Date: Sun, 13 Oct 2024 22:22:53 +0100 Subject: [PATCH] Optimize mem2incident --- resources/providers/config.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/providers/config.rb b/resources/providers/config.rb index 5f0efa9..01acf62 100644 --- a/resources/providers/config.rb +++ b/resources/providers/config.rb @@ -45,14 +45,18 @@ insecure_skip_verify: insecure_skip_verify, loop_interval: loop_interval, auth_token: auth_token) - notifies :restart, 'service[redborder-mem2incident]', :delayed + notifies :restart, 'service[redborder-mem2incident]', :delayed unless node['redborder']['leader_configuring'] end service 'redborder-mem2incident' do service_name 'redborder-mem2incident' ignore_failure true - supports status: true, restart: true, enable: true - action [:start, :enable] + supports status: true, restart: true, enable: true, start: true, stop: true + if node['redborder']['leader_configuring'] + action [:enable, :stop] + else + action [:enable, :start] + end end Chef::Log.info('Redborder mem2incident cookbook has been processed')