summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorJack Foy <jfoy@whitepages.com>2013-07-20 17:42:46 -0700
committerBryan McLellan <btm@opscode.com>2013-10-10 11:29:23 -0700
commit9cb1550cb6fc101a6298517819f708fdc715077e (patch)
tree8e2ce19ed46ce30766f3a447ac06af3f0d684377 /lib/chef/provider
parentba1c3bebc70ae5d9ae76db8878d5b7d9ff164b8e (diff)
downloadchef-9cb1550cb6fc101a6298517819f708fdc715077e.tar.gz
Add specialized action_enable method to Chef::Provider::Service::Debian
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/service/debian.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb
index f52099921f..4d2cc97518 100644
--- a/lib/chef/provider/service/debian.rb
+++ b/lib/chef/provider/service/debian.rb
@@ -86,6 +86,12 @@ class Chef
end
end
+ # Reduce existing priority back to an integer if appropriate, picking
+ # runlevel 2 as a baseline
+ if priority[2] && [2..5].all? { |runlevel| priority[runlevel] == priority[2] }
+ priority = priority[2].last
+ end
+
unless @rcd_status.exitstatus == 0
@priority_success = false
end
@@ -105,6 +111,20 @@ class Chef
enabled
end
+ # Override method from parent to ensure priority is up-to-date
+ def action_enable
+ if @current_resource.enabled && @current_resource.priority == @new_resource.priority
+ Chef::Log.debug("#{@new_resource} already enabled - nothing to do")
+ else
+ converge_by("enable service #{@new_resource}") do
+ enable_service
+ Chef::Log.info("#{@new_resource} enabled")
+ end
+ end
+ load_new_resource_state
+ @new_resource.enabled(true)
+ end
+
def enable_service()
if @new_resource.priority.is_a? Integer
run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove")