summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2014-08-07 17:38:13 -0400
committerBryan McLellan <btm@loftninjas.org>2014-08-12 16:51:12 -0400
commitb7f83596f2ac47c4d41743900ad83db4153ea43c (patch)
tree5f589a670bb00039830e26a2cc40e5ac17ffb962
parent1cca6c457ad21b7d6127300a21ec0185dde20565 (diff)
downloadchef-b7f83596f2ac47c4d41743900ad83db4153ea43c.tar.gz
CHEF-5022: Rename start_type to current_start_type
This is to be more clear what current_start_type returns.
-rw-r--r--lib/chef/provider/service/windows.rb14
-rw-r--r--spec/unit/provider/service/windows_spec.rb4
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb
index 5123edbea0..d31aad4c9d 100644
--- a/lib/chef/provider/service/windows.rb
+++ b/lib/chef/provider/service/windows.rb
@@ -50,7 +50,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
@current_resource.service_name(@new_resource.service_name)
@current_resource.running(current_state == RUNNING)
Chef::Log.debug "#{@new_resource} running: #{@current_resource.running}"
- case start_type
+ case current_start_type
when AUTO_START
@current_resource.enabled(true)
when DISABLED
@@ -146,7 +146,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
end
def action_enable
- if start_type != AUTO_START
+ if current_start_type != AUTO_START
converge_by("enable service #{@new_resource}") do
enable_service
Chef::Log.info("#{@new_resource} enabled")
@@ -159,7 +159,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
end
def action_disable
- if start_type != DISABLED
+ if current_start_type != DISABLED
converge_by("disable service #{@new_resource}") do
disable_service
Chef::Log.info("#{@new_resource} disabled")
@@ -174,7 +174,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
def action_configure_startup
case @new_resource.startup_type
when :automatic
- if start_type != AUTO_START
+ if current_start_type != AUTO_START
converge_by("set service #{@new_resource} startup type to automatic") do
set_startup_type(:automatic)
end
@@ -182,7 +182,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
Chef::Log.debug("#{@new_resource} startup_type already automatic - nothing to do")
end
when :manual
- if start_type != MANUAL
+ if current_start_type != MANUAL
converge_by("set service #{@new_resource} startup type to manual") do
set_startup_type(:manual)
end
@@ -190,7 +190,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
Chef::Log.debug("#{@new_resource} startup_type already manual - nothing to do")
end
when :disabled
- if start_type != DISABLED
+ if current_start_type != DISABLED
converge_by("set service #{@new_resource} startup type to disabled") do
set_startup_type(:disabled)
end
@@ -208,7 +208,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
Win32::Service.status(@new_resource.service_name).current_state
end
- def start_type
+ def current_start_type
Win32::Service.config_info(@new_resource.service_name).start_type
end
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 0c71d0ff41..c51d07b20f 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -331,14 +331,14 @@ describe Chef::Provider::Service::Windows, "load_current_resource" do
{ :automatic => "auto start", :manual => "demand start", :disabled => "disabled" }.each do |type,win32|
it "sets the startup type to #{type} if it is something else" do
@new_resource.startup_type(type)
- @provider.stub(:start_type).and_return("fire")
+ @provider.stub(:current_start_type).and_return("fire")
@provider.should_receive(:set_startup_type).with(type)
@provider.action_configure_startup
end
it "leaves the startup type as #{type} if it is already set" do
@new_resource.startup_type(type)
- @provider.stub(:start_type).and_return(win32)
+ @provider.stub(:current_start_type).and_return(win32)
@provider.should_not_receive(:set_startup_type).with(type)
@provider.action_configure_startup
end