[chef] Deleting a file in windows Env


Chronological Thread 
  • From: Sachin Gupta < >
  • To:
  • Cc: sachin kumar < >
  • Subject: [chef] Deleting a file in windows Env
  • Date: Wed, 10 Dec 2014 15:29:28 +0530

Hello,

I am trying to remove a windows package AspNetMVC4Setup.exe. through chef solo

code used to delete AspNetMVC4Setup.exe package

# Delete ASP.NET MVC 4 Installer
#
file "#{Chef::Config[:file_cache_path]}\\#{basename}" do
  action :delete
end

I am unable to delete the package, but while using cookbook_file resource, I am able to delete the package.

# Delete ASP.NET MVC 4 Installer

  cookbook_file "Delete ASP.NET MVC 4 Installer" do
  path "#{Chef::Config[:file_cache_path]}\\#{basename}"
  action :delete
  end


Is there any difference while deleting a file from cookbook_file vs file. also what would be the best approach. I am not getting any error messages while using cookbook_file instead of file .

The error messages when run with file resource are::

[2014-12-10T17:43:57+00:00] INFO: Processing remote_file[C:\chef\AspNetMVC4Setup.exe] action create (ms_web_platform::asp_net_mvc_4 line 18)
[2014-12-10T17:43:57+00:00] INFO: remote_file[C:\chef\AspNetMVC4Setup.exe] created file C:\chef\AspNetMVC4Setup.exe
[2014-12-10T17:44:00+00:00] INFO: remote_file[C:\chef\AspNetMVC4Setup.exe] updated file contents C:\chef\AspNetMVC4Setup.exe
[2014-12-10T17:44:00+00:00] INFO: Processing execute[Install ASP.NET MVC 4] action run (ms_web_platform::asp_net_mvc_4 line 24)
[2014-12-10T17:44:05+00:00] INFO: execute[Install ASP.NET MVC 4] ran successfully
[2014-12-10T17:44:05+00:00] INFO: Processing file[C:\chef\AspNetMVC4Setup.exe] action delete (ms_web_platform::asp_net_mvc_4 line 45)
[2014-12-10T17:44:05+00:00] INFO: file[C:\chef\AspNetMVC4Setup.exe] backed up to C:\chef\backup\chef\AspNetMVC4Setup.exe.chef-20141210174405.437500
[2014-12-10T17:44:05+00:00] INFO: Running queued delayed notifications before re-raising exception
[2014-12-10T17:44:05+00:00] ERROR: Running exception handlers
[2014-12-10T17:44:05+00:00] ERROR: Exception handlers complete
[2014-12-10T17:44:05+00:00] FATAL: Stacktrace dumped to C:/chef/chef-stacktrace.out
[2014-12-10T17:44:05+00:00] FATAL: Errno::EACCES: file[C:\chef\AspNetMVC4Setup.exe] (ms_web_platform::asp_net_mvc_4 line 45) had an error: Errno::EACCES: Permission denied - C:\chef\AspNetMVC4Setup.exe


Thanks & Regards,
Sachin Gupta





  • [chef] Deleting a file in windows Env, Sachin Gupta, 12/10/2014

Archive powered by MHonArc 2.6.16.

§