[chef] Need help while setting paging file


Chronological Thread 
  • From: Sachin Gupta < >
  • To: " " < >
  • Cc: sachin kumar < >
  • Subject: [chef] Need help while setting paging file
  • Date: Tue, 3 Feb 2015 17:59:48 +0530

Hi All,

I am running this function through chef recipe to create a paging file. This will check if the paging file is present else will create a paging file in p:\

def CreatingPagingFileP?
 if defined?(node[:WinTest][:CurrentInitialPagingFileSizeMBP]) && (node[:WinTest][:CurrentInitialPagingFileSizeMBP] != '')
 puts "paging file is already present. Nothing to set"
 else
 puts "Need to create the paging file"
    cmd=Mixlib::ShellOut.new('wmic pagefileset create name="p:\pagefile.sys"')
    cmd.run_command
    puts cmd.stdout
    check_for_errors(cmd.stderr)
    puts "max=#{node[:WinTest][:PagingFileSizeMBP]}"
       
    com=Mixlib::ShellOut.new('wmic pagefileset where  SettingID="pagefile.sys @ p:" set InitialSize=2048,MaximumSize=%max%')
    com.run_command
    puts com.stdout
    check_for_errors(com.stderr)
 end

 I would like to parametrize InitialSize and MaximumSize, so that they can be set to values from attribute file.
 I tried setting MaximumSize with options like #{node[:WinTest][:PagingFileSizeMBP]}, %max%, max but nothing is working.
 Can anyone help me in setting these values through a variable.

Thanks & Regards,
Sachin Gupta



Archive powered by MHonArc 2.6.16.

§