[chef] Re: Need help while setting paging file


Chronological Thread 
  • From: Ranjib Dey < >
  • To: " " < >
  • Cc: sachin kumar < >
  • Subject: [chef] Re: Need help while setting paging file
  • Date: Tue, 3 Feb 2015 08:27:11 -0800

you;ll need to define two attributes for two of those value. convert the mixlib::shellout call to an execute resource.

if node,attribute?(attr1) and node['attr1'].attribute?(attr2)
  command  = "something #{node[attr1][max]}   and #{node[attr1][min]}"
  execute command do
      action :run
  end
end

On Tue, Feb 3, 2015 at 4:29 AM, Sachin Gupta < " target="_blank"> > wrote:
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.

§