EACCESS error with remote_file resource on Windows

I need your help for something, although there is enough documentation around
resources - I am kind of stuck at a place where I am not able to figure out the
best way to proceed further. So thought of checking with you. Here is the
situation:

I am writing a cookbook for a Windows 2008 R2; workstation on Win 7, whose
default recipe should download a zip from FTP and create it on the host. I am
using remote_file resource for it.
Below is the code in the default.rb recipe:

directory “c:\working” do
recursive true
action :delete
end

directory “c:\working” do
rights :full_control, [“Administrators”,“Everyone”,“asharad”],
:applies_to_children => true
inherits false
action :create
end

remote_file “c:\working\cps.zip” do
source “#{node[‘deploy910cps’][‘cps_zip’]}” # source attribute has value like
"ftp://hostname/910/working/cps.zip"
rights :full_control, [“Administrators”,“Everyone”,“asharad”],
:applies_to_childern => true
action :create
end

Not thing much 1. del the working dir, 2. create a working dir with the
permissions, 3. use the remote_file resource to create the zip under c:\working

What I am seeing chef-client log is:
[2013-10-10T21:01:15+05:30] INFO: remote_file[c:\working\cps.zip] created file
c:\working\cps.zip

================================================================================
Error executing action create on resource ‘remote_file[c:\working\cps.zip]’

Errno::EACCES

Permission denied - (C:/cps.zip20131010-3100-11zywy1, c:/working/cps.zip)

Resource Declaration:

In C:/chef/cache/cookbooks/deploy910cps/recipes/default.rb

The stack trace suggest the below:
Generated at 2013-10-11 09:55:29 +0530
Errno::EACCES: remote_file[c:\working\cps.zip] (deploy910cps::default line 49)
had an error: Errno::EACCES: Permission denied -
(C:/Windows/System32/cps.zip20131011-2220-zwt8oo, c:/working/cps.zip)
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:in rename' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:inblock in mv’
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1515:in block in fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1531:infu_each_src_dest0’
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1513:in fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:508:inmv’
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/file_content_management/deploy/mv_windows.rb:78:in
deploy' C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provider/file.rb:331:inupdate_file_contents’

Please suggest what could be it, I am wondering if it is a bug and if I can
have a workaround. chef client on the node is on version: INFO: *** Chef 11.6.0


Any suggestions would be appreciated.

Regards
Aniket Sharad

I think I’ve seen issues with this – can you try adding this attribute to
the resource:

atomic_update false

and see if this helps?

-Adam

-----Original Message-----
From: aniketsharad@gmail.com [mailto:aniketsharad@gmail.com]
Sent: Thursday, October 10, 2013 10:15 PM
To: chef@lists.opscode.com
Subject: [chef] EACCESS error with remote_file resource on Windows

I need your help for something, although there is enough documentation
around resources - I am kind of stuck at a place where I am not able to
figure out the best way to proceed further. So thought of checking with you.
Here is the
situation:

I am writing a cookbook for a Windows 2008 R2; workstation on Win 7, whose
default recipe should download a zip from FTP and create it on the host. I
am using remote_file resource for it.
Below is the code in the default.rb recipe:

directory “c:\working” do
recursive true
action :delete
end

directory “c:\working” do
rights :full_control, [“Administrators”,“Everyone”,“asharad”],
:applies_to_children => true
inherits false
action :create
end

remote_file “c:\working\cps.zip” do
source “#{node[‘deploy910cps’][‘cps_zip’]}” # source attribute has value
like "ftp://hostname/910/working/cps.zip"
rights :full_control, [“Administrators”,“Everyone”,“asharad”],
:applies_to_childern => true
action :create
end

Not thing much 1. del the working dir, 2. create a working dir with the
permissions, 3. use the remote_file resource to create the zip under
c:\working

What I am seeing chef-client log is:
[2013-10-10T21:01:15+05:30] INFO: remote_file[c:\working\cps.zip] created
file c:\working\cps.zip

============================================================================

Error executing action create on resource
’remote_file[c:\working\cps.zip]’

====

Errno::EACCES

Permission denied - (C:/cps.zip20131010-3100-11zywy1, c:/working/cps.zip)

Resource Declaration:

In C:/chef/cache/cookbooks/deploy910cps/recipes/default.rb

The stack trace suggest the below:
Generated at 2013-10-11 09:55:29 +0530
Errno::EACCES: remote_file[c:\working\cps.zip] (deploy910cps::default line
49) had an error: Errno::EACCES: Permission denied -
(C:/Windows/System32/cps.zip20131011-2220-zwt8oo, c:/working/cps.zip)
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:in rename' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:inblock in mv’
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1515:in block in fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1531:infu_each_src_dest0’
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1513:in
fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:508:inmv’
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/file_
content_management/deploy/mv_windows.rb:78:in
deploy' C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provi der/file.rb:331:inupdate_file_contents’

Please suggest what could be it, I am wondering if it is a bug and if I can
have a workaround. chef client on the node is on version: INFO: *** Chef
11.6.0


Any suggestions would be appreciated.

Regards
Aniket Sharad

Hey Adam

This helps, it works well now!
BTW is this a new addition? I don't see it in recourse remote_file's
documentation....

Cheers
Aniket

On 11 October 2013 21:52, Adam Edwards adamed@opscode.com wrote:

I think I've seen issues with this -- can you try adding this attribute to
the resource:

atomic_update false

and see if this helps?

-Adam

-----Original Message-----
From: aniketsharad@gmail.com [mailto:aniketsharad@gmail.com]
Sent: Thursday, October 10, 2013 10:15 PM
To: chef@lists.opscode.com
Subject: [chef] EACCESS error with remote_file resource on Windows

I need your help for something, although there is enough documentation
around resources - I am kind of stuck at a place where I am not able to
figure out the best way to proceed further. So thought of checking with
you.
Here is the
situation:

I am writing a cookbook for a Windows 2008 R2; workstation on Win 7, whose
default recipe should download a zip from FTP and create it on the host. I
am using remote_file resource for it.
Below is the code in the default.rb recipe:

directory "c:\working" do
recursive true
action :delete
end

directory "c:\working" do
rights :full_control, ["Administrators","Everyone","asharad"],
:applies_to_children => true
inherits false
action :create
end

remote_file "c:\working\cps.zip" do
source "#{node['deploy910cps']['cps_zip']}" # source attribute has value
like "ftp://hostname/910/working/cps.zip"
rights :full_control, ["Administrators","Everyone","asharad"],
:applies_to_childern => true
action :create
end

Not thing much 1. del the working dir, 2. create a working dir with the
permissions, 3. use the remote_file resource to create the zip under
c:\working

What I am seeing chef-client log is:
[2013-10-10T21:01:15+05:30] INFO: remote_file[c:\working\cps.zip] created
file c:\working\cps.zip

============================================================================

Error executing action create on resource
'remote_file[c:\working\cps.zip]'

============================================================================

Errno::EACCES

Permission denied - (C:/cps.zip20131010-3100-11zywy1, c:/working/cps.zip)

Resource Declaration:

In C:/chef/cache/cookbooks/deploy910cps/recipes/default.rb

The stack trace suggest the below:
Generated at 2013-10-11 09:55:29 +0530
Errno::EACCES: remote_file[c:\working\cps.zip] (deploy910cps::default line
49) had an error: Errno::EACCES: Permission denied -
(C:/Windows/System32/cps.zip20131011-2220-zwt8oo, c:/working/cps.zip)
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:in rename' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:in block in mv'
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1515:in block in fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1531:in fu_each_src_dest0'
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1513:in
fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:508:in mv'

C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/file_
content_management/deploy/mv_windows.rb:78:in
`deploy'

C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provi
der/file.rb:331:in
`update_file_contents'

Please suggest what could be it, I am wondering if it is a bug and if I can
have a workaround. chef client on the node is on version: INFO: *** Chef
11.6.0


Any suggestions would be appreciated.

Regards
Aniket Sharad

Aniket, this is a regression, probably in 11.6.0 – you shouldn’t have to add this attribute, and this usage without the attribute worked fine in previous releases. Also, there is no need for the workaround on non-Windows platforms.

I’ve opened ticket https://tickets.opscode.com/browse/CHEF-4625 to cover this.

Thank you for reporting this to the mailing list, and my apologies for the need to work around this until we correct the regression.

-Adam

From: Aniket Sharad [mailto:aniketsharad@gmail.com]
Sent: Monday, October 14, 2013 12:08 AM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: EACCESS error with remote_file resource on Windows

Hey Adam

This helps, it works well now!

BTW is this a new addition? I don’t see it in recourse remote_file’s documentation…

Cheers

Aniket

On 11 October 2013 21:52, Adam Edwards <adamed@opscode.com mailto:adamed@opscode.com > wrote:

I think I’ve seen issues with this – can you try adding this attribute to
the resource:

atomic_update false

and see if this helps?

-Adam

-----Original Message-----
From: aniketsharad@gmail.com mailto:aniketsharad@gmail.com [mailto:aniketsharad@gmail.com mailto:aniketsharad@gmail.com ]
Sent: Thursday, October 10, 2013 10:15 PM
To: chef@lists.opscode.com mailto:chef@lists.opscode.com
Subject: [chef] EACCESS error with remote_file resource on Windows

I need your help for something, although there is enough documentation
around resources - I am kind of stuck at a place where I am not able to
figure out the best way to proceed further. So thought of checking with you.
Here is the
situation:

I am writing a cookbook for a Windows 2008 R2; workstation on Win 7, whose
default recipe should download a zip from FTP and create it on the host. I
am using remote_file resource for it.
Below is the code in the default.rb recipe:

directory “c:\working” do
recursive true
action :delete
end

directory “c:\working” do
rights :full_control, [“Administrators”,“Everyone”,“asharad”],
:applies_to_children => true
inherits false
action :create
end

remote_file “c:\working\cps.zip” do
source “#{node[‘deploy910cps’][‘cps_zip’]}” # source attribute has value
like "ftp://hostname/910/working/cps.zip"
rights :full_control, [“Administrators”,“Everyone”,“asharad”],
:applies_to_childern => true
action :create
end

Not thing much 1. del the working dir, 2. create a working dir with the
permissions, 3. use the remote_file resource to create the zip under
c:\working

What I am seeing chef-client log is:
[2013-10-10T21:01:15+05:30] INFO: remote_file[c:\working\cps.zip] created
file c:\working\cps.zip

============================================================================

Error executing action create on resource
’remote_file[c:\working\cps.zip]’

====

Errno::EACCES

Permission denied - (C:/cps.zip20131010-3100-11zywy1, c:/working/cps.zip)

Resource Declaration:

In C:/chef/cache/cookbooks/deploy910cps/recipes/default.rb

The stack trace suggest the below:
Generated at 2013-10-11 09:55:29 +0530
Errno::EACCES: remote_file[c:\working\cps.zip] (deploy910cps::default line
49) had an error: Errno::EACCES: Permission denied -
(C:/Windows/System32/cps.zip20131011-2220-zwt8oo, c:/working/cps.zip)
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:in rename' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:inblock in mv’
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1515:in block in fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1531:infu_each_src_dest0’
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1513:in
fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:508:inmv’
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/file_
content_management/deploy/mv_windows.rb:78:in
deploy' C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provi der/file.rb:331:inupdate_file_contents’

Please suggest what could be it, I am wondering if it is a bug and if I can
have a workaround. chef client on the node is on version: INFO: *** Chef
11.6.0


Any suggestions would be appreciated.

Regards
Aniket Sharad

Thanks for you help Adam and creating a ticket to cover it!

On 15 October 2013 01:02, Adam Edwards adamed@opscode.com wrote:

Aniket, this is a regression, probably in 11.6.0 – you shouldn’t have to
add this attribute, and this usage without the attribute worked fine in
previous releases. Also, there is no need for the workaround on non-Windows
platforms.****


I’ve opened ticket https://tickets.opscode.com/browse/CHEF-4625 to cover
this.****


Thank you for reporting this to the mailing list, and my apologies for the
need to work around this until we correct the regression.****


-Adam****


From: Aniket Sharad [mailto:aniketsharad@gmail.com]
Sent: Monday, October 14, 2013 12:08 AM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: EACCESS error with remote_file resource on
Windows****


Hey Adam****


This helps, it works well now!****

BTW is this a new addition? I don't see it in recourse remote_file's
documentation....****


Cheers****

Aniket****


On 11 October 2013 21:52, Adam Edwards adamed@opscode.com wrote:****

I think I've seen issues with this -- can you try adding this attribute to
the resource:

atomic_update false

and see if this helps?

-Adam****

-----Original Message-----
From: aniketsharad@gmail.com [mailto:aniketsharad@gmail.com]
Sent: Thursday, October 10, 2013 10:15 PM
To: chef@lists.opscode.com
Subject: [chef] EACCESS error with remote_file resource on Windows

I need your help for something, although there is enough documentation
around resources - I am kind of stuck at a place where I am not able to
figure out the best way to proceed further. So thought of checking with
you.
Here is the
situation:

I am writing a cookbook for a Windows 2008 R2; workstation on Win 7, whose
default recipe should download a zip from FTP and create it on the host. I
am using remote_file resource for it.
Below is the code in the default.rb recipe:

directory "c:\working" do
recursive true
action :delete
end

directory "c:\working" do
rights :full_control, ["Administrators","Everyone","asharad"],
:applies_to_children => true
inherits false
action :create
end

remote_file "c:\working\cps.zip" do
source "#{node['deploy910cps']['cps_zip']}" # source attribute has value
like "ftp://hostname/910/working/cps.zip"
rights :full_control, ["Administrators","Everyone","asharad"],
:applies_to_childern => true
action :create
end

Not thing much 1. del the working dir, 2. create a working dir with the
permissions, 3. use the remote_file resource to create the zip under
c:\working

What I am seeing chef-client log is:
[2013-10-10T21:01:15+05:30] INFO: remote_file[c:\working\cps.zip] created
file c:\working\cps.zip

============================================================================

Error executing action create on resource
'remote_file[c:\working\cps.zip]'

============================================================================

Errno::EACCES

Permission denied - (C:/cps.zip20131010-3100-11zywy1, c:/working/cps.zip)

Resource Declaration:

In C:/chef/cache/cookbooks/deploy910cps/recipes/default.rb

The stack trace suggest the below:
Generated at 2013-10-11 09:55:29 +0530
Errno::EACCES: remote_file[c:\working\cps.zip] (deploy910cps::default line
49) had an error: Errno::EACCES: Permission denied -
(C:/Windows/System32/cps.zip20131011-2220-zwt8oo, c:/working/cps.zip)
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:in rename' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:519:in block in mv'
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1515:in block in fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1531:in fu_each_src_dest0'
C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:1513:in
fu_each_src_dest' C:/opscode/chef/embedded/lib/ruby/1.9.1/fileutils.rb:508:in mv'

C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/file_
content_management/deploy/mv_windows.rb:78:in
`deploy'

C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.0/lib/chef/provi
der/file.rb:331:in
`update_file_contents'

Please suggest what could be it, I am wondering if it is a bug and if I can
have a workaround. chef client on the node is on version: INFO: *** Chef
11.6.0


Any suggestions would be appreciated.

Regards
Aniket Sharad****