Skip to content

Commit 7eabc40

Browse files
authored
Merge pull request #1799 from nickanderson/ENT-6074/master
ENT-6074/master: Added service states "active" and "inactive" for systemd
2 parents 603f8d7 + 5d1a01f commit 7eabc40

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/services.cf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bundle agent standard_services(service,state)
8282
# @brief Standard services bundle, used by CFEngine by default
8383
# @author CFEngine AS
8484
# @param service Name of service to control
85-
# @param state The desired state for that service: "start", "restart", "reload", "stop", or "disable". "enable", "enabled", and "disabled" are also able to be used when systemd is detected.
85+
# @param state The desired state for that service: "start", "restart", "reload", "stop", or "disable". "enable", "enabled", and "disabled" are also able to be used when systemd is detected. "active" and "inactive" states are supported for systemd managed hosts and can be used for controlling the services currently running state, but make no promises about the service state on boot.
8686
#
8787
# This bundle is used by CFEngine if you don't specify a services
8888
# handler explicitly, and will work with systemd or chkconfig or other
@@ -208,10 +208,12 @@ bundle agent standard_services(service,state)
208208
"request_disabled" expression => strcmp("disabled", "$(state)");
209209
"request_enable" expression => strcmp("enable", "$(state)");
210210
"request_enabled" expression => strcmp("enabled", "$(state)");
211+
"request_active" expression => strcmp("active", "$(state)");
212+
"request_inactive" expression => strcmp("inactive", "$(state)");
211213

212-
"action_custom" expression => "!(request_start|request_stop|request_reload|request_restart|request_disable|request_disabled|request_enable|request_enabled)";
213-
"action_start" expression => "request_start.!service_active.can_start_service";
214-
"action_stop" expression => "request_stop.service_active.can_stop_service";
214+
"action_custom" expression => "!(request_start|request_stop|request_reload|request_restart|request_disable|request_disabled|request_enable|request_enabled|request_active|request_inactive)";
215+
"action_start" expression => "(request_start|request_active).!service_active.can_start_service";
216+
"action_stop" expression => "(request_stop|request_inactive).service_active.can_stop_service";
215217
"action_reload" expression => "request_reload.service_active.can_reload_service";
216218
"action_restart" or => {
217219
"request_restart",

0 commit comments

Comments
 (0)