From abdc55b1deaaa2ce687f5b5efde5b7c88cdd67a3 Mon Sep 17 00:00:00 2001 From: "Benjamin M. Hughes" Date: Sat, 9 Jan 2021 12:30:30 +0000 Subject: [PATCH] Improve robustness of systemd service configuration This is as good as we can get until https://github.com/hashicorp/vault/issues/5079 is merged. Notified restarts will still NOT cause a Chef run failure, although any subsequest (re)starts WILL. --- libraries/helpers.rb | 1 + resources/service.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/libraries/helpers.rb b/libraries/helpers.rb index 0eedf00b..f18832f7 100644 --- a/libraries/helpers.rb +++ b/libraries/helpers.rb @@ -101,6 +101,7 @@ def default_vault_unit_content 'StartLimitBurst' => 3, }, 'Service' => { + 'Type' => 'exec', 'User' => user, 'Group' => group, 'ProtectSystem' => 'full', diff --git a/resources/service.rb b/resources/service.rb index b11eced9..c47cc809 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -58,6 +58,8 @@ def do_service_action(resource_action) with_run_context(:root) do edit_resource(:service, new_resource.service_name.delete_suffix('.service')) do + supports status: true, restart: true, reload: true + action :nothing delayed_action resource_action end