summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewis <nick@puppetlabs.com>2011-07-26 11:38:05 -0700
committerJacob Helwig <jacob@puppetlabs.com>2011-08-19 13:52:57 -0700
commit9c575bd9106b3ffed92c357ead8ff06c01c484d5 (patch)
tree0ecab4b222fcafddd4383a1a7fcecd63ec47c97e
parentad29bf6114f637adfd686e88535aa79bc8cae7b8 (diff)
downloadpuppet-9c575bd9106b3ffed92c357ead8ff06c01c484d5.tar.gz
puppet-9c575bd9106b3ffed92c357ead8ff06c01c484d5.tar.xz
puppet-9c575bd9106b3ffed92c357ead8ff06c01c484d5.zip
(#8272) Fixup logging in Windows service provider
We want to use self.debug for logging in the provider, so that log messages are properly associated with the resource, rather than generically coming from Puppet. Also fix the self.instances method to not use an unnecessary extra variable when collecting. Reviewed-By: Jacob Helwig <jacob@puppetlabs.com> (cherry picked from commit 38c181d00e87ecc699c6a3e23dd2155f716a6602)
-rw-r--r--lib/puppet/provider/service/windows.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/puppet/provider/service/windows.rb b/lib/puppet/provider/service/windows.rb
index 09754ffda..56d56b0a9 100644
--- a/lib/puppet/provider/service/windows.rb
+++ b/lib/puppet/provider/service/windows.rb
@@ -41,7 +41,7 @@ Puppet::Type.type(:service).provide :windows do
def enabled?
w32ss = Win32::Service.config_info( @resource[:name] )
raise Puppet::Error.new("Win32 service query of #{@resource[:name]} failed" ) unless( !w32ss.nil? && w32ss.instance_of?( Struct::ServiceConfigInfo ) )
- Puppet.debug("Service #{@resource[:name]} start type is #{w32ss.start_type}")
+ debug("Service #{@resource[:name]} start type is #{w32ss.start_type}")
case w32ss.start_type
when Win32::Service.get_start_type(Win32::Service::SERVICE_AUTO_START),
Win32::Service.get_start_type(Win32::Service::SERVICE_BOOT_START),
@@ -84,7 +84,7 @@ Puppet::Type.type(:service).provide :windows do
else
raise Puppet::Error.new("Unknown service state '#{w32ss.current_state}' for service '#{@resource[:name]}'")
end
- Puppet.debug("Service #{@resource[:name]} is #{w32ss.current_state}")
+ debug("Service #{@resource[:name]} is #{w32ss.current_state}")
return state
rescue Win32::Service::Error => detail
raise Puppet::Error.new("Cannot get status of #{@resource[:name]}, error was: #{detail}" )
@@ -92,10 +92,6 @@ Puppet::Type.type(:service).provide :windows do
# returns all providers for all existing services and startup state
def self.instances
- srvcs = []
- Win32::Service.services.collect{ |s|
- srvcs << new(:name => s.service_name)
- }
- srvcs
+ Win32::Service.services.collect { |s| new(:name => s.service_name) }
end
end