From 881c3858e88b6cc3d2c0e7bea6785fcbf091e4c0 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Tue, 26 Jul 2011 15:58:31 -0700 Subject: (#8272) Use symbols instead of booleans for enabled property on Windows Because the enable property of the service type uses :true and :false as its valid values, rather than true and false, we need to return :true and :false from our enabled? method. Otherwise, the property was being synced every time it was enabled or disabled, regardless of whether it was actually in sync or not. Reviewed-By: Jacob Helwig (cherry picked from commit 44e2d494f499e2005c1b31b92b97834189d4224d) --- lib/puppet/provider/service/windows.rb | 4 ++-- spec/unit/provider/service/windows_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/puppet/provider/service/windows.rb b/lib/puppet/provider/service/windows.rb index 56d56b0a9..d77f3b44a 100644 --- a/lib/puppet/provider/service/windows.rb +++ b/lib/puppet/provider/service/windows.rb @@ -46,11 +46,11 @@ Puppet::Type.type(:service).provide :windows do when Win32::Service.get_start_type(Win32::Service::SERVICE_AUTO_START), Win32::Service.get_start_type(Win32::Service::SERVICE_BOOT_START), Win32::Service.get_start_type(Win32::Service::SERVICE_SYSTEM_START) - true + :true when Win32::Service.get_start_type(Win32::Service::SERVICE_DEMAND_START) :manual when Win32::Service.get_start_type(Win32::Service::SERVICE_DISABLED) - false + :false else raise Puppet::Error.new("Unknown start type: #{w32ss.start_type}") end diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb index be2f33c20..fff875032 100755 --- a/spec/unit/provider/service/windows_spec.rb +++ b/spec/unit/provider/service/windows_spec.rb @@ -105,7 +105,7 @@ describe provider_class, :if => Puppet.features.microsoft_windows? do ) ) resource = Puppet::Type.type(:service).new(:name => 'snmptrap') - resource.provider.enabled?.should == false + resource.provider.enabled?.should == :false end # We need to guard this section explicitly since rspec will always @@ -122,7 +122,7 @@ describe provider_class, :if => Puppet.features.microsoft_windows? do ) ) resource = Puppet::Type.type(:service).new(:name => 'snmptrap') - resource.provider.enabled?.should == true + resource.provider.enabled?.should == :true end end end -- cgit