diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2011-07-26 15:58:31 -0700 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-07-26 16:41:05 -0700 |
| commit | 44e2d494f499e2005c1b31b92b97834189d4224d (patch) | |
| tree | c37c9dc06fbcc0e270d1e8a0a6d280ef4bc97a2b | |
| parent | 38c181d00e87ecc699c6a3e23dd2155f716a6602 (diff) | |
(#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 <jacob@puppetlabs.com>
| -rw-r--r-- | lib/puppet/provider/service/windows.rb | 4 | ||||
| -rwxr-xr-x | 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 |
