diff options
author | Tim Smith <tsmith@chef.io> | 2021-02-03 14:57:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-03 14:57:22 -0800 |
commit | 3d586a3b038db3c7cba86b7393c0d3b7e0840161 (patch) | |
tree | 4cd5a124456a222938ddfc07cc6d15b70b923e6b /lib/chef | |
parent | ef07092cade60b92914a128a1065bc87909af465 (diff) | |
parent | e89693875cef26ba22941fd8b042dcbe758e70e3 (diff) | |
download | chef-3d586a3b038db3c7cba86b7393c0d3b7e0840161.tar.gz |
Merge pull request #10976 from joshuamiller01/handle_sysv_compat_case_for_systemd_service_enabled
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/provider/service/systemd.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb index 9b0cf3abd8..f8fac18bc3 100644 --- a/lib/chef/provider/service/systemd.rb +++ b/lib/chef/provider/service/systemd.rb @@ -202,6 +202,11 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple end def is_enabled? + # if the service is in sysv compat mode, shellout to determine if enabled + if systemd_service_status["UnitFileState"] == "bad" + options, args = get_systemctl_options_args + return shell_out(systemctl_path, args, "is-enabled", new_resource.service_name, "--quiet", **options).exitstatus == 0 + end # See https://github.com/systemd/systemd/blob/master/src/systemctl/systemctl-is-enabled.c # Note: enabled-runtime is excluded because this is volatile, and the state of enabled-runtime # specifically means that the service is not enabled |