Skip to content

Commit 50a5875

Browse files
basvandervliesnickanderson
authored andcommitted
Stopped disabling disabled systemd unit each run when disabled state requested
Each cfengine run the service was disabled even if the `UnitFileState` was `disabled`. This change adds support for the disabled service state when managing systemd services. Changelog: Title Ticket: CFE-3367
1 parent f051c51 commit 50a5875

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/services.cf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,9 @@ bundle agent standard_services(service,state)
251251
"request_stop" expression => strcmp("stop", "$(state)");
252252
"request_reload" expression => strcmp("reload", "$(state)");
253253
"request_restart" expression => strcmp("restart", "$(state)");
254+
"request_disable" expression => strcmp("disable", "$(state)");
254255

255-
"action_custom" expression => "!(request_start|request_stop|request_reload|request_restart)";
256+
"action_custom" expression => "!(request_start|request_stop|request_reload|request_restart|request_disable)";
256257
"action_start" expression => "request_start.!service_active.can_start_service";
257258
"action_stop" expression => "request_stop.service_active.can_stop_service";
258259
"action_reload" expression => "request_reload.service_active.can_reload_service";
@@ -269,7 +270,7 @@ bundle agent standard_services(service,state)
269270
"action_enable" expression => "request_start.!service_enabled";
270271

271272
# Respectively, stopping it implicitly disables it
272-
"action_disable" expression => "request_stop.service_enabled";
273+
"action_disable" expression => "(request_disable|request_stop).service_enabled";
273274

274275
commands:
275276
systemd.service_loaded:: # note this class is defined in `inventory/linux.cf`

0 commit comments

Comments
 (0)