summaryrefslogtreecommitdiff
path: root/lib/chef/provider/service
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-03-23 13:05:13 +0000
committerTim Smith <tsmith@chef.io>2018-03-26 10:34:39 -0700
commit97c1dd6f1cac6d97e85d05039cad8b28596141ba (patch)
treed8a97c0f7016986a2cc264aa50ae345638ed026c /lib/chef/provider/service
parent1b81f35e023bcdc87e410c641545e849298de5c3 (diff)
downloadchef-97c1dd6f1cac6d97e85d05039cad8b28596141ba.tar.gz
mechanical conversion of most debug log statements to trace
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'lib/chef/provider/service')
-rw-r--r--lib/chef/provider/service/aix.rb6
-rw-r--r--lib/chef/provider/service/aixinit.rb4
-rw-r--r--lib/chef/provider/service/debian.rb6
-rw-r--r--lib/chef/provider/service/freebsd.rb6
-rw-r--r--lib/chef/provider/service/gentoo.rb4
-rw-r--r--lib/chef/provider/service/macosx.rb14
-rw-r--r--lib/chef/provider/service/openbsd.rb2
-rw-r--r--lib/chef/provider/service/simple.rb14
-rw-r--r--lib/chef/provider/service/systemd.rb6
-rw-r--r--lib/chef/provider/service/upstart.rb18
-rw-r--r--lib/chef/provider/service/windows.rb54
11 files changed, 67 insertions, 67 deletions
diff --git a/lib/chef/provider/service/aix.rb b/lib/chef/provider/service/aix.rb
index dd74caf6ae..10ea06152b 100644
--- a/lib/chef/provider/service/aix.rb
+++ b/lib/chef/provider/service/aix.rb
@@ -88,7 +88,7 @@ class Chef
protected
def determine_current_status!
- Chef::Log.debug "#{@new_resource} using lssrc to check the status"
+ logger.trace "#{@new_resource} using lssrc to check the status"
begin
if is_resource_group?
# Groups as a whole have no notion of whether they're running
@@ -101,7 +101,7 @@ class Chef
@current_resource.running false
end
end
- Chef::Log.debug "#{@new_resource} running: #{@current_resource.running}"
+ logger.trace "#{@new_resource} running: #{@current_resource.running}"
# ShellOut sometimes throws different types of Exceptions than ShellCommandFailed.
# Temporarily catching different types of exceptions here until we get Shellout fixed.
# TODO: Remove the line before one we get the ShellOut fix.
@@ -115,7 +115,7 @@ class Chef
def is_resource_group?
so = shell_out("lssrc -g #{@new_resource.service_name}")
if so.exitstatus == 0
- Chef::Log.debug("#{@new_resource.service_name} is a group")
+ logger.trace("#{@new_resource.service_name} is a group")
@is_resource_group = true
end
end
diff --git a/lib/chef/provider/service/aixinit.rb b/lib/chef/provider/service/aixinit.rb
index 73c5e07715..dd8514cf20 100644
--- a/lib/chef/provider/service/aixinit.rb
+++ b/lib/chef/provider/service/aixinit.rb
@@ -45,11 +45,11 @@ class Chef
priority_ok = @current_resource.priority == @new_resource.priority
end
if @current_resource.enabled && priority_ok
- Chef::Log.debug("#{@new_resource} already enabled - nothing to do")
+ logger.trace("#{@new_resource} already enabled - nothing to do")
else
converge_by("enable service #{@new_resource}") do
enable_service
- Chef::Log.info("#{@new_resource} enabled")
+ logger.info("#{@new_resource} enabled")
end
end
load_new_resource_state
diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb
index fcfa34ddf9..01a1ed3ad9 100644
--- a/lib/chef/provider/service/debian.rb
+++ b/lib/chef/provider/service/debian.rb
@@ -101,7 +101,7 @@ class Chef
def service_currently_enabled?(priority)
enabled = false
priority.each do |runlevel, arguments|
- Chef::Log.debug("#{new_resource} runlevel #{runlevel}, action #{arguments[0]}, priority #{arguments[1]}")
+ logger.trace("#{new_resource} runlevel #{runlevel}, action #{arguments[0]}, priority #{arguments[1]}")
# if we are in a update-rc.d default startup runlevel && we start in this runlevel
if %w{ 1 2 3 4 5 S }.include?(runlevel) && arguments[0] == :start
enabled = true
@@ -119,11 +119,11 @@ class Chef
priority_ok = @current_resource.priority == new_resource.priority
end
if current_resource.enabled && priority_ok
- Chef::Log.debug("#{new_resource} already enabled - nothing to do")
+ logger.trace("#{new_resource} already enabled - nothing to do")
else
converge_by("enable service #{new_resource}") do
enable_service
- Chef::Log.info("#{new_resource} enabled")
+ logger.info("#{new_resource} enabled")
end
end
load_new_resource_state
diff --git a/lib/chef/provider/service/freebsd.rb b/lib/chef/provider/service/freebsd.rb
index c1e315afee..68de39fd0f 100644
--- a/lib/chef/provider/service/freebsd.rb
+++ b/lib/chef/provider/service/freebsd.rb
@@ -47,7 +47,7 @@ class Chef
return current_resource unless init_command
- Chef::Log.debug("#{current_resource} found at #{init_command}")
+ logger.trace("#{current_resource} found at #{init_command}")
@status_load_success = true
determine_current_status! # see Chef::Provider::Service::Simple
@@ -145,7 +145,7 @@ class Chef
end
# some scripts support multiple instances through symlinks such as openvpn.
# We should get the service name from rcvar.
- Chef::Log.debug("name=\"service\" not found at #{init_command}. falling back to rcvar")
+ logger.trace("name=\"service\" not found at #{init_command}. falling back to rcvar")
shell_out!("#{init_command} rcvar").stdout[/(\w+_enable)=/, 1]
else
# for why-run mode when the rcd_script is not there yet
@@ -171,7 +171,7 @@ class Chef
end
if current_resource.enabled.nil?
- Chef::Log.debug("#{new_resource.name} enable/disable state unknown")
+ logger.trace("#{new_resource.name} enable/disable state unknown")
current_resource.enabled false
end
end
diff --git a/lib/chef/provider/service/gentoo.rb b/lib/chef/provider/service/gentoo.rb
index 0ac74649b6..69b3d20a3f 100644
--- a/lib/chef/provider/service/gentoo.rb
+++ b/lib/chef/provider/service/gentoo.rb
@@ -36,11 +36,11 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init
@found_script = true
exists = ::File.exists? file
readable = ::File.readable? file
- Chef::Log.debug "#{@new_resource} exists: #{exists}, readable: #{readable}"
+ logger.trace "#{@new_resource} exists: #{exists}, readable: #{readable}"
exists && readable
end
)
- Chef::Log.debug "#{@new_resource} enabled: #{@current_resource.enabled}"
+ logger.trace "#{@new_resource} enabled: #{@current_resource.enabled}"
@current_resource
end
diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb
index a0ae03a717..40021f9ba6 100644
--- a/lib/chef/provider/service/macosx.rb
+++ b/lib/chef/provider/service/macosx.rb
@@ -58,7 +58,7 @@ class Chef
if @console_user
@console_user = Etc.getpwuid(::File.stat("/dev/console").uid).name
- Chef::Log.debug("#{new_resource} console_user: '#{@console_user}'")
+ logger.trace("#{new_resource} console_user: '#{@console_user}'")
cmd = "su "
param = this_version_or_newer?("10.10") ? "" : "-l "
param = "-l " if this_version_or_newer?("10.12")
@@ -67,7 +67,7 @@ class Chef
@session_type = "Aqua" if @session_type.nil?
end
- Chef::Log.debug("#{new_resource} Plist: '#{@plist}' service_label: '#{@service_label}'")
+ logger.trace("#{new_resource} Plist: '#{@plist}' service_label: '#{@service_label}'")
set_service_status
@current_resource
@@ -108,7 +108,7 @@ class Chef
def start_service
if @current_resource.running
- Chef::Log.debug("#{@new_resource} already running, not starting")
+ logger.trace("#{@new_resource} already running, not starting")
else
if @new_resource.start_command
super
@@ -120,7 +120,7 @@ class Chef
def stop_service
unless @current_resource.running
- Chef::Log.debug("#{@new_resource} not running, not stopping")
+ logger.trace("#{@new_resource} not running, not stopping")
else
if @new_resource.stop_command
super
@@ -147,7 +147,7 @@ class Chef
# supervisor that will restart daemons that are crashing, etc.
def enable_service
if @current_resource.enabled
- Chef::Log.debug("#{@new_resource} already enabled, not enabling")
+ logger.trace("#{@new_resource} already enabled, not enabling")
else
load_service
end
@@ -155,7 +155,7 @@ class Chef
def disable_service
unless @current_resource.enabled
- Chef::Log.debug("#{@new_resource} not enabled, not disabling")
+ logger.trace("#{@new_resource} not enabled, not disabling")
else
unload_service
end
@@ -199,7 +199,7 @@ class Chef
when /\s+\"pid\"\s+=\s+(\d+).*/
pid = $1
@current_resource.running(pid.to_i != 0)
- Chef::Log.debug("Current PID for #{@service_label} is #{pid}")
+ logger.trace("Current PID for #{@service_label} is #{pid}")
end
end
else
diff --git a/lib/chef/provider/service/openbsd.rb b/lib/chef/provider/service/openbsd.rb
index f839d54780..552173fbee 100644
--- a/lib/chef/provider/service/openbsd.rb
+++ b/lib/chef/provider/service/openbsd.rb
@@ -48,7 +48,7 @@ class Chef
@current_resource = Chef::Resource::Service.new(new_resource.name)
current_resource.service_name(new_resource.service_name)
- Chef::Log.debug("#{current_resource} found at #{init_command}")
+ logger.trace("#{current_resource} found at #{init_command}")
determine_current_status!
determine_enabled_status!
diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb
index 81ac970b87..7b5f75c4b3 100644
--- a/lib/chef/provider/service/simple.rb
+++ b/lib/chef/provider/service/simple.rb
@@ -108,12 +108,12 @@ class Chef
def determine_current_status!
if @new_resource.status_command
- Chef::Log.debug("#{@new_resource} you have specified a status command, running..")
+ logger.trace("#{@new_resource} you have specified a status command, running..")
begin
if shell_out(@new_resource.status_command).exitstatus == 0
@current_resource.running true
- Chef::Log.debug("#{@new_resource} is running")
+ logger.trace("#{@new_resource} is running")
end
rescue Mixlib::ShellOut::ShellCommandFailed, SystemCallError
# ShellOut sometimes throws different types of Exceptions than ShellCommandFailed.
@@ -125,11 +125,11 @@ class Chef
end
elsif supports[:status]
- Chef::Log.debug("#{@new_resource} supports status, running")
+ logger.trace("#{@new_resource} supports status, running")
begin
if shell_out("#{default_init_command} status").exitstatus == 0
@current_resource.running true
- Chef::Log.debug("#{@new_resource} is running")
+ logger.trace("#{@new_resource} is running")
end
# ShellOut sometimes throws different types of Exceptions than ShellCommandFailed.
# Temporarily catching different types of exceptions here until we get Shellout fixed.
@@ -140,9 +140,9 @@ class Chef
nil
end
else
- Chef::Log.debug "#{@new_resource} falling back to process table inspection"
+ logger.trace "#{@new_resource} falling back to process table inspection"
r = Regexp.new(@new_resource.pattern)
- Chef::Log.debug "#{@new_resource} attempting to match '#{@new_resource.pattern}' (#{r.inspect}) against process list"
+ logger.trace "#{@new_resource} attempting to match '#{@new_resource.pattern}' (#{r.inspect}) against process list"
begin
shell_out!(ps_cmd).stdout.each_line do |line|
if r.match(line)
@@ -152,7 +152,7 @@ class Chef
end
@current_resource.running false unless @current_resource.running
- Chef::Log.debug "#{@new_resource} running: #{@current_resource.running}"
+ logger.trace "#{@new_resource} running: #{@current_resource.running}"
# ShellOut sometimes throws different types of Exceptions than ShellCommandFailed.
# Temporarily catching different types of exceptions here until we get Shellout fixed.
# TODO: Remove the line before one we get the ShellOut fix.
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb
index fa9d381267..1bcc2f3a00 100644
--- a/lib/chef/provider/service/systemd.rb
+++ b/lib/chef/provider/service/systemd.rb
@@ -42,7 +42,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
@status_check_success = true
if new_resource.status_command
- Chef::Log.debug("#{new_resource} you have specified a status command, running..")
+ logger.trace("#{new_resource} you have specified a status command, running..")
unless shell_out(new_resource.status_command).error?
current_resource.running(true)
@@ -95,7 +95,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
def start_service
if current_resource.running
- Chef::Log.debug("#{new_resource} already running, not starting")
+ logger.trace("#{new_resource} already running, not starting")
else
if new_resource.start_command
super
@@ -108,7 +108,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
def stop_service
unless current_resource.running
- Chef::Log.debug("#{new_resource} not running, not stopping")
+ logger.trace("#{new_resource} not running, not stopping")
else
if new_resource.stop_command
super
diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb
index 2ff7de1138..810d9eabb7 100644
--- a/lib/chef/provider/service/upstart.rb
+++ b/lib/chef/provider/service/upstart.rb
@@ -109,7 +109,7 @@ class Chef
# We do not support searching for a service via ps when using upstart since status is a native
# upstart function. We will however support status_command in case someone wants to do something special.
if @new_resource.status_command
- Chef::Log.debug("#{@new_resource} you have specified a status command, running..")
+ logger.trace("#{@new_resource} you have specified a status command, running..")
begin
if shell_out!(@new_resource.status_command).exitstatus == 0
@@ -135,16 +135,16 @@ class Chef
end
# Get enabled/disabled state by reading job configuration file
if ::File.exists?("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
- Chef::Log.debug("#{@new_resource} found #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
+ logger.trace("#{@new_resource} found #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
::File.open("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}", "r") do |file|
while line = file.gets
case line
when /^start on/
- Chef::Log.debug("#{@new_resource} enabled: #{line.chomp}")
+ logger.trace("#{@new_resource} enabled: #{line.chomp}")
@current_resource.enabled true
break
when /^#start on/
- Chef::Log.debug("#{@new_resource} disabled: #{line.chomp}")
+ logger.trace("#{@new_resource} disabled: #{line.chomp}")
@current_resource.enabled false
break
end
@@ -152,7 +152,7 @@ class Chef
end
else
@config_file_found = false
- Chef::Log.debug("#{@new_resource} did not find #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
+ logger.trace("#{@new_resource} did not find #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
@current_resource.enabled false
end
@@ -164,7 +164,7 @@ class Chef
# Calling start on a service that is already started will return 1
# Our 'goal' when we call start is to ensure the service is started
if @upstart_service_running
- Chef::Log.debug("#{@new_resource} already running, not starting")
+ logger.trace("#{@new_resource} already running, not starting")
else
if @new_resource.start_command
super
@@ -180,7 +180,7 @@ class Chef
# Calling stop on a service that is already stopped will return 1
# Our 'goal' when we call stop is to ensure the service is stopped
unless @upstart_service_running
- Chef::Log.debug("#{@new_resource} not running, not stopping")
+ logger.trace("#{@new_resource} not running, not stopping")
else
if @new_resource.stop_command
super
@@ -226,14 +226,14 @@ class Chef
# https://bugs.launchpad.net/upstart/+bug/94065
def enable_service
- Chef::Log.debug("#{@new_resource} upstart lacks inherent support for enabling services, editing job config file")
+ logger.trace("#{@new_resource} upstart lacks inherent support for enabling services, editing job config file")
conf = Chef::Util::FileEdit.new("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
conf.search_file_replace(/^#start on/, "start on")
conf.write_file
end
def disable_service
- Chef::Log.debug("#{@new_resource} upstart lacks inherent support for disabling services, editing job config file")
+ logger.trace("#{@new_resource} upstart lacks inherent support for disabling services, editing job config file")
conf = Chef::Util::FileEdit.new("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
conf.search_file_replace(/^start on/, "#start on")
conf.write_file
diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb
index ce84f7c4ee..cba626145a 100644
--- a/lib/chef/provider/service/windows.rb
+++ b/lib/chef/provider/service/windows.rb
@@ -57,14 +57,14 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
if Win32::Service.exists?(current_resource.service_name)
current_resource.running(current_state == RUNNING)
- Chef::Log.debug "#{new_resource} running: #{current_resource.running}"
+ logger.trace "#{new_resource} running: #{current_resource.running}"
case current_startup_type
when :automatic
current_resource.enabled(true)
when :disabled
current_resource.enabled(false)
end
- Chef::Log.debug "#{new_resource} enabled: #{current_resource.enabled}"
+ logger.trace "#{new_resource} enabled: #{current_resource.enabled}"
config_info = Win32::Service.config_info(current_resource.service_name)
current_resource.service_type(get_service_type(config_info.service_type)) if config_info.service_type
@@ -91,7 +91,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
}.reject { |k, v| v.nil? || v.length == 0 }
Win32::Service.configure(new_config)
- Chef::Log.info "#{@new_resource} configured with #{new_config.inspect}"
+ logger.info "#{@new_resource} configured with #{new_config.inspect}"
if new_config.has_key?(:service_start_name)
unless Chef::ReservedNames::Win32::Security.get_account_right(canonicalize_username(new_config[:service_start_name])).include?(SERVICE_RIGHT)
@@ -101,13 +101,13 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
state = current_state
if state == RUNNING
- Chef::Log.debug "#{@new_resource} already started - nothing to do"
+ logger.trace "#{@new_resource} already started - nothing to do"
elsif state == START_PENDING
- Chef::Log.debug "#{@new_resource} already sent start signal - waiting for start"
+ logger.trace "#{@new_resource} already sent start signal - waiting for start"
wait_for_state(RUNNING)
elsif state == STOPPED
if @new_resource.start_command
- Chef::Log.debug "#{@new_resource} starting service using the given start_command"
+ logger.trace "#{@new_resource} starting service using the given start_command"
shell_out!(@new_resource.start_command)
else
spawn_command_thread do
@@ -115,7 +115,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
Win32::Service.start(@new_resource.service_name)
rescue SystemCallError => ex
if ex.errno == ERROR_SERVICE_LOGON_FAILED
- Chef::Log.error ex.message
+ logger.error ex.message
raise Chef::Exceptions::Service,
"Service #{@new_resource} did not start due to a logon failure (error #{ERROR_SERVICE_LOGON_FAILED}): possibly the specified user '#{@new_resource.run_as_user}' does not have the 'log on as a service' privilege, or the password is incorrect."
else
@@ -130,7 +130,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
raise Chef::Exceptions::Service, "Service #{@new_resource} can't be started from state [#{state}]"
end
else
- Chef::Log.debug "#{@new_resource} does not exist - nothing to do"
+ logger.trace "#{@new_resource} does not exist - nothing to do"
end
end
@@ -139,7 +139,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
state = current_state
if state == RUNNING
if @new_resource.stop_command
- Chef::Log.debug "#{@new_resource} stopping service using the given stop_command"
+ logger.trace "#{@new_resource} stopping service using the given stop_command"
shell_out!(@new_resource.stop_command)
else
spawn_command_thread do
@@ -149,22 +149,22 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
end
@new_resource.updated_by_last_action(true)
elsif state == STOPPED
- Chef::Log.debug "#{@new_resource} already stopped - nothing to do"
+ logger.trace "#{@new_resource} already stopped - nothing to do"
elsif state == STOP_PENDING
- Chef::Log.debug "#{@new_resource} already sent stop signal - waiting for stop"
+ logger.trace "#{@new_resource} already sent stop signal - waiting for stop"
wait_for_state(STOPPED)
else
raise Chef::Exceptions::Service, "Service #{@new_resource} can't be stopped from state [#{state}]"
end
else
- Chef::Log.debug "#{@new_resource} does not exist - nothing to do"
+ logger.trace "#{@new_resource} does not exist - nothing to do"
end
end
def restart_service
if Win32::Service.exists?(@new_resource.service_name)
if @new_resource.restart_command
- Chef::Log.debug "#{@new_resource} restarting service using the given restart_command"
+ logger.trace "#{@new_resource} restarting service using the given restart_command"
shell_out!(@new_resource.restart_command)
else
stop_service
@@ -172,7 +172,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
end
@new_resource.updated_by_last_action(true)
else
- Chef::Log.debug "#{@new_resource} does not exist - nothing to do"
+ logger.trace "#{@new_resource} does not exist - nothing to do"
end
end
@@ -180,7 +180,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
if Win32::Service.exists?(@new_resource.service_name)
set_startup_type(:automatic)
else
- Chef::Log.debug "#{@new_resource} does not exist - nothing to do"
+ logger.trace "#{@new_resource} does not exist - nothing to do"
end
end
@@ -188,13 +188,13 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
if Win32::Service.exists?(@new_resource.service_name)
set_startup_type(:disabled)
else
- Chef::Log.debug "#{@new_resource} does not exist - nothing to do"
+ logger.trace "#{@new_resource} does not exist - nothing to do"
end
end
action :create do
if Win32::Service.exists?(new_resource.service_name)
- Chef::Log.debug "#{new_resource} already exists - nothing to do"
+ logger.trace "#{new_resource} already exists - nothing to do"
return
end
@@ -207,7 +207,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
action :delete do
unless Win32::Service.exists?(new_resource.service_name)
- Chef::Log.debug "#{new_resource} does not exist - nothing to do"
+ logger.trace "#{new_resource} does not exist - nothing to do"
return
end
@@ -218,7 +218,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
action :configure do
unless Win32::Service.exists?(new_resource.service_name)
- Chef::Log.warn "#{new_resource} does not exist. Maybe you need to prepend action :create"
+ logger.warn "#{new_resource} does not exist. Maybe you need to prepend action :create"
return
end
@@ -240,10 +240,10 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
if current_startup_type != :automatic
converge_by("enable service #{@new_resource}") do
enable_service
- Chef::Log.info("#{@new_resource} enabled")
+ logger.info("#{@new_resource} enabled")
end
else
- Chef::Log.debug("#{@new_resource} already enabled - nothing to do")
+ logger.trace("#{@new_resource} already enabled - nothing to do")
end
load_new_resource_state
@new_resource.enabled(true)
@@ -253,10 +253,10 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
if current_startup_type != :disabled
converge_by("disable service #{@new_resource}") do
disable_service
- Chef::Log.info("#{@new_resource} disabled")
+ logger.info("#{@new_resource} disabled")
end
else
- Chef::Log.debug("#{@new_resource} already disabled - nothing to do")
+ logger.trace("#{@new_resource} already disabled - nothing to do")
end
load_new_resource_state
@new_resource.enabled(false)
@@ -269,7 +269,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
set_startup_type(startup_type)
end
else
- Chef::Log.debug("#{@new_resource} startup_type already #{startup_type} - nothing to do")
+ logger.trace("#{@new_resource} startup_type already #{startup_type} - nothing to do")
end
# Avoid changing enabled from true/false for now
@@ -290,11 +290,11 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
begin
Chef::ReservedNames::Win32::Security.add_account_right(canonicalize_username(username), SERVICE_RIGHT)
rescue Chef::Exceptions::Win32APIError => err
- Chef::Log.fatal "Logon-as-service grant failed with output: #{err}"
+ logger.fatal "Logon-as-service grant failed with output: #{err}"
raise Chef::Exceptions::Service, "Logon-as-service grant failed for #{username}: #{err}"
end
- Chef::Log.info "Grant logon-as-service to user '#{username}' successful."
+ logger.info "Grant logon-as-service to user '#{username}' successful."
true
end
@@ -356,7 +356,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service
def set_startup_type(type)
startup_type = startup_type_to_int(type)
- Chef::Log.debug "#{@new_resource.name} setting start_type to #{type}"
+ logger.trace "#{@new_resource.name} setting start_type to #{type}"
Win32::Service.configure(
:service_name => @new_resource.service_name,
:start_type => startup_type