summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-08-18 12:01:21 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-08-18 12:01:21 -0700
commit74e6bd6b50af383829f4bfc47ca18a4e089b1428 (patch)
tree5fbb10cba7d9fb87b510d65c75108c5f68fbf006
parent36ef6acfe162152631521b9916b4ca69773c9eb1 (diff)
parent93296a93e135dbf3215e7a1015c727f3f0b07f87 (diff)
downloadchef-74e6bd6b50af383829f4bfc47ca18a4e089b1428.tar.gz
Merge pull request #3656 from chef/lcg/remove-provides
remove use of self.provides?
-rw-r--r--CHANGELOG.md1
-rw-r--r--lib/chef/provider/service/debian.rb8
-rw-r--r--lib/chef/provider/service/insserv.rb6
-rw-r--r--lib/chef/provider/service/invokercd.rb6
-rw-r--r--lib/chef/provider/service/redhat.rb8
-rw-r--r--lib/chef/provider/service/systemd.rb8
-rw-r--r--lib/chef/provider/service/upstart.rb8
7 files changed, 17 insertions, 28 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b0704862eb..a6f54fa428 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@
* [**Renan Vicente**](https://github.com/renanvicente):
[pr#3771](https://github.com/chef/chef/pull/3771) add depth property for deploy resource
+* [pr#3656](https://github.com/chef/chef/pull/3656) remove use of self.provides?
* [pr#3455](https://github.com/chef/chef/pull/3455) powershell\_script: do not allow suppression of syntax errors
* [pr#3519](https://github.com/chef/chef/pull/3519) The wording seemed odd.
* [pr#3208](https://github.com/chef/chef/pull/3208) Missing require (require what you use).
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