diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-07-09 09:13:17 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-08-18 11:59:20 -0700 |
commit | fc33bf5fbd2d8a8bc3daa3df1122f4348deb65f0 (patch) | |
tree | 6bcf185f40b797a590d6647941fd59cfad92ac85 /lib/chef/provider/service | |
parent | 36ef6acfe162152631521b9916b4ca69773c9eb1 (diff) | |
download | chef-fc33bf5fbd2d8a8bc3daa3df1122f4348deb65f0.tar.gz |
remove use of self.provides?
the block to provides can handle this case
Diffstat (limited to 'lib/chef/provider/service')
-rw-r--r-- | lib/chef/provider/service/debian.rb | 8 | ||||
-rw-r--r-- | lib/chef/provider/service/insserv.rb | 6 | ||||
-rw-r--r-- | lib/chef/provider/service/invokercd.rb | 6 | ||||
-rw-r--r-- | lib/chef/provider/service/redhat.rb | 8 | ||||
-rw-r--r-- | lib/chef/provider/service/systemd.rb | 8 | ||||
-rw-r--r-- | lib/chef/provider/service/upstart.rb | 8 |
6 files changed, 16 insertions, 28 deletions
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb index 46c23fdd34..7d23e4ac77 100644 --- a/lib/chef/provider/service/debian.rb +++ b/lib/chef/provider/service/debian.rb @@ -22,15 +22,13 @@ class Chef class Provider class Service class Debian < Chef::Provider::Service::Init - provides :service, platform_family: 'debian' + provides :service, platform_family: 'debian' do |node| + Chef::Platform::ServiceHelpers.service_resource_providers.include?(:debian) + 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.provides?(node, resource) - super && Chef::Platform::ServiceHelpers.service_resource_providers.include?(:debian) - end - def self.supports?(resource, action) Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:initd) end diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb index 2fd2eac38e..dd01f9ab87 100644 --- a/lib/chef/provider/service/insserv.rb +++ b/lib/chef/provider/service/insserv.rb @@ -24,10 +24,8 @@ class Chef class Service class Insserv < Chef::Provider::Service::Init - provides :service, platform_family: %w(debian rhel fedora suse) - - def self.provides?(node, resource) - super && Chef::Platform::ServiceHelpers.service_resource_providers.include?(:insserv) + provides :service, platform_family: %w(debian rhel fedora suse) do |node| + Chef::Platform::ServiceHelpers.service_resource_providers.include?(:insserv) end def self.supports?(resource, action) diff --git a/lib/chef/provider/service/invokercd.rb b/lib/chef/provider/service/invokercd.rb index 39022546b0..2b045e0e60 100644 --- a/lib/chef/provider/service/invokercd.rb +++ b/lib/chef/provider/service/invokercd.rb @@ -23,10 +23,8 @@ class Chef class Service class Invokercd < Chef::Provider::Service::Init - provides :service, platform_family: 'debian', override: true - - def self.provides?(node, resource) - super && Chef::Platform::ServiceHelpers.service_resource_providers.include?(:invokercd) + provides :service, platform_family: 'debian', override: true do |node| + Chef::Platform::ServiceHelpers.service_resource_providers.include?(:invokercd) end def self.supports?(resource, action) diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb index 2330d88eb7..19cd2aa485 100644 --- a/lib/chef/provider/service/redhat.rb +++ b/lib/chef/provider/service/redhat.rb @@ -23,15 +23,13 @@ class Chef class Service class Redhat < Chef::Provider::Service::Init - provides :service, platform_family: %w(rhel fedora suse) + provides :service, platform_family: %w(rhel fedora suse) do |node| + Chef::Platform::ServiceHelpers.service_resource_providers.include?(:redhat) + end CHKCONFIG_ON = /\d:on/ CHKCONFIG_MISSING = /No such/ - def self.provides?(node, resource) - super && Chef::Platform::ServiceHelpers.service_resource_providers.include?(:redhat) - end - def self.supports?(resource, action) Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:initd) end diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb index 9085ffde2e..d41f6248c2 100644 --- a/lib/chef/provider/service/systemd.rb +++ b/lib/chef/provider/service/systemd.rb @@ -24,14 +24,12 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple include Chef::Mixin::Which - provides :service, os: "linux" + provides :service, os: "linux" do |node| + Chef::Platform::ServiceHelpers.service_resource_providers.include?(:systemd) + end attr_accessor :status_check_success - def self.provides?(node, resource) - super && Chef::Platform::ServiceHelpers.service_resource_providers.include?(:systemd) - end - def self.supports?(resource, action) Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:systemd) end diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb index 13145bd055..c08a5f8636 100644 --- a/lib/chef/provider/service/upstart.rb +++ b/lib/chef/provider/service/upstart.rb @@ -26,14 +26,12 @@ class Chef class Service class Upstart < Chef::Provider::Service::Simple - provides :service, platform_family: 'debian', override: true + provides :service, platform_family: 'debian', override: true do |node| + Chef::Platform::ServiceHelpers.service_resource_providers.include?(:upstart) + end UPSTART_STATE_FORMAT = /\w+ \(?(\w+)\)?[\/ ](\w+)/ - def self.provides?(node, resource) - super && Chef::Platform::ServiceHelpers.service_resource_providers.include?(:upstart) - end - def self.supports?(resource, action) Chef::Platform::ServiceHelpers.config_for_service(resource.service_name).include?(:upstart) end |