diff options
Diffstat (limited to 'lib/chef/provider/service')
-rw-r--r-- | lib/chef/provider/service/systemd.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb index e70576fea7..9948d28c0f 100644 --- a/lib/chef/provider/service/systemd.rb +++ b/lib/chef/provider/service/systemd.rb @@ -48,12 +48,14 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple @status_check_success = false current_resource.running(false) current_resource.enabled(false) + current_resource.masked(false) end else current_resource.running(is_active?) end current_resource.enabled(is_enabled?) + current_resource.masked(is_masked?) current_resource end @@ -119,6 +121,14 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple shell_out!("#{systemctl_path} disable #{new_resource.service_name}") end + def mask_service + shell_out!("#{systemctl_path} mask #{new_resource.service_name}") + end + + def unmask_service + shell_out!("#{systemctl_path} unmask #{new_resource.service_name}") + end + def is_active? shell_out("#{systemctl_path} is-active #{new_resource.service_name} --quiet").exitstatus == 0 end @@ -127,6 +137,11 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple shell_out("#{systemctl_path} is-enabled #{new_resource.service_name} --quiet").exitstatus == 0 end + def is_masked? + s = shell_out("#{systemctl_path} is-enabled #{new_resource.service_name}") + s..exitstatus != 0 && s.stdout.include?('masked', 'masked-runtime') + end + private def systemctl_path |