summaryrefslogtreecommitdiff
path: root/lib/chef/resource/windows_pagefile.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/resource/windows_pagefile.rb')
-rw-r--r--lib/chef/resource/windows_pagefile.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/chef/resource/windows_pagefile.rb b/lib/chef/resource/windows_pagefile.rb
index d91ff7bf03..12051db67e 100644
--- a/lib/chef/resource/windows_pagefile.rb
+++ b/lib/chef/resource/windows_pagefile.rb
@@ -110,7 +110,7 @@ class Chef
# @return [Boolean]
def exists?(pagefile)
@exists ||= begin
- Chef::Log.debug("Checking if #{pagefile} exists by runing: #{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" list /format:list")
+ logger.trace("Checking if #{pagefile} exists by runing: #{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" list /format:list")
cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" list /format:list", returns: [0])
cmd.stderr.empty? && (cmd.stdout =~ /SettingID=#{get_setting_id(pagefile)}/i)
end
@@ -124,7 +124,7 @@ class Chef
# @return [Boolean]
def max_and_min_set?(pagefile, min, max)
@max_and_min_set ||= begin
- Chef::Log.debug("Checking if #{pagefile} min: #{min} and max #{max} are set")
+ logger.trace("Checking if #{pagefile} min: #{min} and max #{max} are set")
cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" list /format:list", returns: [0])
cmd.stderr.empty? && (cmd.stdout =~ /InitialSize=#{min}/i) && (cmd.stdout =~ /MaximumSize=#{max}/i)
end
@@ -135,7 +135,7 @@ class Chef
# @param [String] pagefile path to the pagefile
def create(pagefile)
converge_by("create pagefile #{pagefile}") do
- Chef::Log.debug("Running #{wmic} pagefileset create name=\"#{win_friendly_path(pagefile)}\"")
+ logger.trace("Running #{wmic} pagefileset create name=\"#{win_friendly_path(pagefile)}\"")
cmd = shell_out("#{wmic} pagefileset create name=\"#{win_friendly_path(pagefile)}\"")
check_for_errors(cmd.stderr)
end
@@ -146,7 +146,7 @@ class Chef
# @param [String] pagefile path to the pagefile
def delete(pagefile)
converge_by("remove pagefile #{pagefile}") do
- Chef::Log.debug("Running #{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" delete")
+ logger.trace("Running #{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" delete")
cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" delete")
check_for_errors(cmd.stderr)
end
@@ -157,7 +157,7 @@ class Chef
# @return [Boolean]
def automatic_managed?
@automatic_managed ||= begin
- Chef::Log.debug("Checking if pagefiles are automatically managed")
+ logger.trace("Checking if pagefiles are automatically managed")
cmd = shell_out("#{wmic} computersystem where name=\"%computername%\" get AutomaticManagedPagefile /format:list")
cmd.stderr.empty? && (cmd.stdout =~ /AutomaticManagedPagefile=TRUE/i)
end
@@ -166,7 +166,7 @@ class Chef
# turn on automatic management of all pagefiles by Windows
def set_automatic_managed
converge_by("set pagefile to Automatic Managed") do
- Chef::Log.debug("Running #{wmic} computersystem where name=\"%computername%\" set AutomaticManagedPagefile=True")
+ logger.trace("Running #{wmic} computersystem where name=\"%computername%\" set AutomaticManagedPagefile=True")
cmd = shell_out("#{wmic} computersystem where name=\"%computername%\" set AutomaticManagedPagefile=True")
check_for_errors(cmd.stderr)
end
@@ -175,7 +175,7 @@ class Chef
# turn off automatic management of all pagefiles by Windows
def unset_automatic_managed
converge_by("set pagefile to User Managed") do
- Chef::Log.debug("Running #{wmic} computersystem where name=\"%computername%\" set AutomaticManagedPagefile=False")
+ logger.trace("Running #{wmic} computersystem where name=\"%computername%\" set AutomaticManagedPagefile=False")
cmd = shell_out("#{wmic} computersystem where name=\"%computername%\" set AutomaticManagedPagefile=False")
check_for_errors(cmd.stderr)
end
@@ -188,7 +188,7 @@ class Chef
# @param [String] max the minimum size of the pagefile
def set_custom_size(pagefile, min, max)
converge_by("set #{pagefile} to InitialSize=#{min} & MaximumSize=#{max}") do
- Chef::Log.debug("Running #{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" set InitialSize=#{min},MaximumSize=#{max}")
+ logger.trace("Running #{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" set InitialSize=#{min},MaximumSize=#{max}")
cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" set InitialSize=#{min},MaximumSize=#{max}", returns: [0])
check_for_errors(cmd.stderr)
end
@@ -199,7 +199,7 @@ class Chef
# @param [String] pagefile path to the pagefile
def set_system_managed(pagefile)
converge_by("set #{pagefile} to System Managed") do
- Chef::Log.debug("Running #{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" set InitialSize=0,MaximumSize=0")
+ logger.trace("Running #{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" set InitialSize=0,MaximumSize=0")
cmd = shell_out("#{wmic} pagefileset where SettingID=\"#{get_setting_id(pagefile)}\" set InitialSize=0,MaximumSize=0", returns: [0])
check_for_errors(cmd.stderr)
end