By default in Chef 11.6, remote_file uses the atomic update strategy for updating files. On Windows, this results in remote_file resources failing with a source url using the "file:" scheme failing with access denied -- here is an example recipe:
remote_file "#{ENV['HOME']}/non_atomic_works.txt" do
atomic_update false
source "file://#{ENV['SystemDrive']}/windows/system.ini"
end
remote_file "#{ENV['HOME']}/atomic_fails.txt" do
source "file://#{ENV['SystemDrive']}/windows/system.ini"
end
The first remote_file usage above works fine -- the second does not -- the only difference is that the second is using the default atomic (mv) strategy. I believe this is a regression from Chef 11.4. I'll debug further later on.
Log details below:
Starting Chef Client, version 11.6.0.hotfix.1←[0m [2013-09-06T11:17:59-07:00] INFO: *** Chef 11.6.0.hotfix.1 *** [2013-09-06T11:18:27-07:00] WARN: Run List override has been provided. [2013-09-06T11:18:27-07:00] WARN: Original Run List: [] [2013-09-06T11:18:27-07:00] WARN: Overridden Run List: [recipe[uncpain::uncpain_repro]] [2013-09-06T11:18:27-07:00] INFO: Run List is [recipe[uncpain::uncpain_repro]] [2013-09-06T11:18:27-07:00] INFO: Run List expands to [uncpain::uncpain_repro] [2013-09-06T11:18:27-07:00] INFO: Starting Chef Run for sea-adamed1.opscodecorp.com [2013-09-06T11:18:27-07:00] INFO: Running start handlers [2013-09-06T11:18:27-07:00] INFO: Start handlers complete. Compiling Cookbooks...←[0m Converging 2 resources←[0m Recipe: uncpain::uncpain_repro←[0m
- remote_file[C:/Users/edwardsa/non_atomic_works.txt] action create←[0m[2013-09-06T11:18:27-07:00] INFO: Processing r dsa/non_atomic_works.txt] action create (uncpain::uncpain_repro line 1) (up to date)←[0m
- remote_file[C:/Users/edwardsa/atomic_fails.txt] action create←[0m[2013-09-06T11:18:27-07:00] INFO: Processing remot
atomic_fails.txt] action create (uncpain::uncpain_repro line 6)
[2013-09-06T11:18:27-07:00] INFO: remote_file[C:/Users/edwardsa/atomic_fails.txt] created file C:/Users/edwardsa/atomic
←[32m
- create new file C:/Users/edwardsa/atomic_fails.txt←[0m[2013-09-06T11:18:27-07:00] INFO: file: C:/test/cookbooks/u
pro.rb
[2013-09-06T11:18:27-07:00] INFO: line: 6
←[0m
================================================================================←[0m
←[31mError executing action
create
on resource 'remote_file[C:/Users/edwardsa/atomic_fails.txt]'←[0m ================================================================================←[0m
- create new file C:/Users/edwardsa/atomic_fails.txt←[0m[2013-09-06T11:18:27-07:00] INFO: file: C:/test/cookbooks/u
pro.rb
[2013-09-06T11:18:27-07:00] INFO: line: 6
←[0m
================================================================================←[0m
←[31mError executing action
←[0m Errno::EACCES←[0m -------------←[0m Permission denied - (C:/Users/edwardsa/AppData/Local/Temp/atomic_fails.txt20130906-8788-du9lia, C:/Users/edwardsa/atomi
←[0m Resource Declaration:←[0m ---------------------←[0m
6: remote_file "#{ENV['HOME']}/atomic_fails.txt" do 7: source "file://#{ENV['SystemDrive']}/windows/system.ini" 8: end 9: ←[0m
←[0m Compiled Resource:←[0m ------------------←[0m
remote_file("C:/Users/edwardsa/atomic_fails.txt") do provider Chef::Provider::RemoteFile action "create" retries 0 retry_delay 2 path "C:/Users/edwardsa/atomic_fails.txt" backup 5 atomic_update true source ["file://C:/windows/system.ini"] use_etag true use_last_modified true cookbook_name :uncpain recipe_name "uncpain_repro" end ←[0m
←[0m [2013-09-06T11:18:27-07:00] INFO: Running queued delayed notifications before re-raising exception [2013-09-06T11:18:27-07:00] ERROR: Running exception handlers [2013-09-06T11:18:27-07:00] ERROR: Exception handlers complete [2013-09-06T11:18:27-07:00] FATAL: Stacktrace dumped to c:/test/cache/chef-stacktrace.out Chef Client failed. 0 resources updated←[0m [2013-09-06T11:18:27-07:00] FATAL: Errno::EACCES: remote_file[C:/Users/edwardsa/atomic_fails.txt] (uncpain::uncpain_rep Errno::EACCES: Permission denied - (C:/Users/edwardsa/AppData/Local/Temp/atomic_fails.txt20130906-8788-du9lia, C:/Users t)