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 <[email protected]> Signed-off-by: Nick Lewis <[email protected]> --- Local-branch: ticket/master/8272 lib/puppet/provider/service/windows.rb | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/puppet/provider/service/windows.rb b/lib/puppet/provider/service/windows.rb index 09754ff..56d56b0 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 -- 1.7.5.4 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
