summaryrefslogtreecommitdiff
path: root/lib/chef/provider/service
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider/service')
-rw-r--r--lib/chef/provider/service/arch.rb2
-rw-r--r--lib/chef/provider/service/debian.rb8
-rw-r--r--lib/chef/provider/service/init.rb2
-rw-r--r--lib/chef/provider/service/insserv.rb8
-rw-r--r--lib/chef/provider/service/invokercd.rb8
-rw-r--r--lib/chef/provider/service/redhat.rb8
-rw-r--r--lib/chef/provider/service/systemd.rb6
-rw-r--r--lib/chef/provider/service/upstart.rb6
8 files changed, 24 insertions, 24 deletions
diff --git a/lib/chef/provider/service/arch.rb b/lib/chef/provider/service/arch.rb
index e34227036a..da1c71ba8b 100644
--- a/lib/chef/provider/service/arch.rb
+++ b/lib/chef/provider/service/arch.rb
@@ -23,7 +23,7 @@ class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
provides :service, platform_family: "arch"
def self.supports?(resource, action)
- Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:etc_rcd)
+ service_script_exist?(:etc_rcd, resource.service_name)
end
def initialize(new_resource, run_context)
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb
index 351075111b..61cae7421b 100644
--- a/lib/chef/provider/service/debian.rb
+++ b/lib/chef/provider/service/debian.rb
@@ -1,6 +1,6 @@
#
# Author:: AJ Christensen (<aj@hjksolutions.com>)
-# Copyright:: Copyright 2008-2017, Chef Software Inc.
+# Copyright:: Copyright 2008-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,15 +22,15 @@ class Chef
class Provider
class Service
class Debian < Chef::Provider::Service::Init
- provides :service, platform_family: "debian" do |node|
- Chef::Platform::ServiceHelpers.service_resource_providers.include?(:debian)
+ provides :service, platform_family: "debian" do
+ debianrcd?
end
UPDATE_RC_D_ENABLED_MATCHES = /\/rc[\dS].d\/S|not installed/i
UPDATE_RC_D_PRIORITIES = /\/rc([\dS]).d\/([SK])(\d\d)/i
def self.supports?(resource, action)
- Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:initd)
+ service_script_exist?(:initd, resource.service_name)
end
def load_current_resource
diff --git a/lib/chef/provider/service/init.rb b/lib/chef/provider/service/init.rb
index 6d150513cc..55f2d7d509 100644
--- a/lib/chef/provider/service/init.rb
+++ b/lib/chef/provider/service/init.rb
@@ -29,7 +29,7 @@ class Chef
provides :service, os: "!windows"
def self.supports?(resource, action)
- Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:initd)
+ service_script_exist?(:initd, resource.service_name)
end
def initialize(new_resource, run_context)
diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb
index a8e841f8b3..2ea9dbd340 100644
--- a/lib/chef/provider/service/insserv.rb
+++ b/lib/chef/provider/service/insserv.rb
@@ -1,6 +1,6 @@
#
# Author:: Bryan McLellan <btm@loftninjas.org>
-# Copyright:: Copyright 2011-2017, Chef Software Inc.
+# Copyright:: Copyright 2011-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,12 +24,12 @@ class Chef
class Service
class Insserv < Chef::Provider::Service::Init
- provides :service, platform_family: %w{debian rhel fedora suse amazon} do |node|
- Chef::Platform::ServiceHelpers.service_resource_providers.include?(:insserv)
+ provides :service, platform_family: %w{debian rhel fedora suse amazon} do
+ insserv?
end
def self.supports?(resource, action)
- Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:initd)
+ service_script_exist?(:initd, resource.service_name)
end
def load_current_resource
diff --git a/lib/chef/provider/service/invokercd.rb b/lib/chef/provider/service/invokercd.rb
index 9477afec48..08c9f0ebc3 100644
--- a/lib/chef/provider/service/invokercd.rb
+++ b/lib/chef/provider/service/invokercd.rb
@@ -1,6 +1,6 @@
#
# Author:: AJ Christensen (<aj@hjksolutions.com>)
-# Copyright:: Copyright 2008-2016, Chef Software Inc.
+# Copyright:: Copyright 2008-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,12 +23,12 @@ class Chef
class Service
class Invokercd < Chef::Provider::Service::Init
- provides :service, platform_family: "debian", override: true do |node|
- Chef::Platform::ServiceHelpers.service_resource_providers.include?(:invokercd)
+ provides :service, platform_family: "debian", override: true do
+ invokercd?
end
def self.supports?(resource, action)
- Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:initd)
+ service_script_exist?(:initd, resource.service_name)
end
def initialize(new_resource, run_context)
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index 18ef245083..77b83aae1f 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -1,6 +1,6 @@
#
# Author:: AJ Christensen (<aj@hjksolutions.com>)
-# Copyright:: Copyright 2008-2017, Chef Software Inc.
+# Copyright:: Copyright 2008-2018, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,15 +28,15 @@ class Chef
# @api private
attr_accessor :current_run_levels
- provides :service, platform_family: %w{rhel fedora suse amazon} do |node|
- Chef::Platform::ServiceHelpers.service_resource_providers.include?(:redhat)
+ provides :service, platform_family: "rpm_based" do
+ redhatrcd?
end
CHKCONFIG_ON = /\d:on/
CHKCONFIG_MISSING = /No such/
def self.supports?(resource, action)
- Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:initd)
+ service_script_exist?(:initd, resource.service_name)
end
def initialize(new_resource, run_context)
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb
index 6d5bc338c7..fac4686c4f 100644
--- a/lib/chef/provider/service/systemd.rb
+++ b/lib/chef/provider/service/systemd.rb
@@ -26,14 +26,14 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
include Chef::Mixin::Which
- provides :service, os: "linux" do |node|
- Chef::Platform::ServiceHelpers.service_resource_providers.include?(:systemd)
+ provides :service, os: "linux" do
+ systemd?
end
attr_accessor :status_check_success
def self.supports?(resource, action)
- Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:systemd)
+ service_script_exist?(:systemd, resource.service_name)
end
def load_current_resource
diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb
index 68f97d1ff2..f2ff182aa9 100644
--- a/lib/chef/provider/service/upstart.rb
+++ b/lib/chef/provider/service/upstart.rb
@@ -28,15 +28,15 @@ class Chef
# to maintain a local state of service across restart's internal calls
attr_accessor :upstart_service_running
- provides :service, platform_family: "debian", override: true do |node|
- Chef::Platform::ServiceHelpers.service_resource_providers.include?(:upstart)
+ provides :service, platform_family: "debian", override: true do
+ upstart?
end
UPSTART_STATE_FORMAT = /\S+ \(?(start|stop)?\)? ?[\/ ](\w+)/
# Returns true if the configs for the service name has upstart variable
def self.supports?(resource, action)
- Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:upstart)
+ service_script_exist?(:upstart, resource.service_name)
end
# Upstart does more than start or stop a service, creating multiple 'states' [1] that a service can be in.