From 5ac3583a14f63c14da77290585c3e2dde438a7e3 Mon Sep 17 00:00:00 2001 From: Chris Swingler Date: Wed, 20 Apr 2016 16:01:31 -0500 Subject: [PATCH] Removing assumptions on how services are handled and allow more flexibility --- attributes/php_agent.rb | 2 ++ providers/agent_php.rb | 5 ++++- resources/agent_php.rb | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/attributes/php_agent.rb b/attributes/php_agent.rb index 5a683a1e..c187a586 100644 --- a/attributes/php_agent.rb +++ b/attributes/php_agent.rb @@ -10,6 +10,8 @@ default['newrelic']['php_agent']['startup_mode'] = nil default['newrelic']['php_agent']['web_server']['service_name'] = nil default['newrelic']['php_agent']['web_server']['service_action'] = nil +default['newrelic']['php_agent']['web_server']['service_provider'] = nil +default['newrelic']['php_agent']['web_server']['service_supports'] = {:status => true, :start => true, :stop => true, :restart => true, :reload => true} default['newrelic']['php_agent']['config_file'] = nil default['newrelic']['php_agent']['config_file_to_be_deleted'] = nil default['newrelic']['php_agent']['execute_php5enmod'] = nil diff --git a/providers/agent_php.rb b/providers/agent_php.rb index f3b8562a..1f6a2c13 100644 --- a/providers/agent_php.rb +++ b/providers/agent_php.rb @@ -84,7 +84,10 @@ def newrelic_daemon def webserver_service service new_resource.service_name do - supports :status => true, :start => true, :stop => true, :restart => true, :reload => true + supports new_resource.service_supports + if new_resource.service_provider + provider eval(new_resource.service_provider) + end end end diff --git a/resources/agent_php.rb b/resources/agent_php.rb index 6e1bff14..5569354d 100644 --- a/resources/agent_php.rb +++ b/resources/agent_php.rb @@ -17,6 +17,8 @@ attribute :config_file_to_be_deleted, :kind_of => String, :default => nil attribute :service_name, :kind_of => String, :default => nil attribute :service_action, :kind_of => String, :default => 'restart' +attribute :service_provider, :kind_of => String, :default => nil +attribute :service_supports, :kind_of => Hash, :default => {:status => true, :start => true, :stop => true, :restart => true, :reload => true} attribute :execute_php5enmod, :kind_of => [TrueClass, FalseClass], :default => false attribute :cookbook_ini, :kind_of => String, :default => 'newrelic' attribute :source_ini, :kind_of => String, :default => 'agent/php/newrelic.ini.erb'