Problem with file downloads

Hello!

Problem:
each time I run chef-client winscp.exe file is downloaded. It’s about 6MB.

Environment:
I’ve got following recipe:

cookbook_file “#{dfclient}/bin/winscp.exe” do
source "winscp.exe"
backup false
end

dfclient is in libraray, in form:

ef dfclient
ENV[“DFCLIENT”].gsub("\",::File::SEPARATOR)
end

my client.rb is:

require 'win32ole’
WIN32OLE.codepage = WIN32OLE::CP_UTF8
log_level :info
log_location STDOUT
chef_server_url "http://xxx:4000"
validation_client_name "chef-validator"
validation_key "C:/df/etc/chef/validation.pem"
client_key "C:/df/etc/chef/client.pem"
node_name "0000-dragonfly.GRAF0-KOMPUTER"
file_cache_path "C:/df/var/cache/chef/files"
file_backup_path "C:/df/var/cache/chef/backups"
checksum_path “C:/df/var/cache/chef/checksums”

all directories exists and are writeable for chef-client user (it’s SYSTEM).

system is windows 7 enterprise, ruby version: ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mingw32], chef - I tried 0.9.12 and 0.9.14-beta.1. No other recipes are run on that node.

First approach was to use cookbook_file to download a bunch of installers from server - but unfortunately, those installers were downloaded EACH time I run chef-client. I’ve got following log entries at INFO level:

[Fri, 11 Feb 2011 14:28:02 +0100] INFO: Starting Chef Run (Version 0.9.14.beta.1
)
[Fri, 11 Feb 2011 14:28:21 +0100] INFO: Storing updated cookbooks/winscp/files/d
efault/winscp.exe in the cache.
[Fri, 11 Feb 2011 14:28:21 +0100] INFO: Backing up current file at C:/df/bin/win
scp.exe
[Fri, 11 Feb 2011 14:28:28 +0100] INFO: Chef Run complete in 25.121094 seconds
[Fri, 11 Feb 2011 14:28:28 +0100] INFO: cleaning the checksum cache
[Fri, 11 Feb 2011 14:28:28 +0100] INFO: Running report handlers
[Fri, 11 Feb 2011 14:28:28 +0100] INFO: Report handlers complete

Any ideas, what is wrong?


Grzegorz Marszałek
graf0@post.pl

On Friday, February 11, 2011 at 5:29 AM, Grzegorz Marszałek wrote:
Hello!

Problem:
each time I run chef-client winscp.exe file is downloaded. It's about 6MB.

Environment:
I've got following recipe:

cookbook_file "#{dfclient}/bin/winscp.exe" do
source "winscp.exe"
backup false
end

dfclient is in libraray, in form:

ef dfclient
ENV["DFCLIENT"].gsub("\",::File::SEPARATOR)
end

my client.rb is:

require 'win32ole'
WIN32OLE.codepage = WIN32OLE::CP_UTF8
log_level :info
log_location STDOUT
chef_server_url "http://xxx:4000"
validation_client_name "chef-validator"
validation_key "C:/df/etc/chef/validation.pem"
client_key "C:/df/etc/chef/client.pem"
node_name "0000-dragonfly.GRAF0-KOMPUTER"
file_cache_path "C:/df/var/cache/chef/files"
file_backup_path "C:/df/var/cache/chef/backups"
checksum_path "C:/df/var/cache/chef/checksums"

all directories exists and are writeable for chef-client user (it's SYSTEM).

system is windows 7 enterprise, ruby version: ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mingw32], chef - I tried 0.9.12 and 0.9.14-beta.1. No other recipes are run on that node.

First approach was to use cookbook_file to download a bunch of installers from server - but unfortunately, those installers were downloaded EACH time I run chef-client. I've got following log entries at INFO level:

[Fri, 11 Feb 2011 14:28:02 +0100] INFO: Starting Chef Run (Version 0.9.14.beta.1
)
[Fri, 11 Feb 2011 14:28:21 +0100] INFO: Storing updated cookbooks/winscp/files/d
efault/winscp.exe in the cache.
[Fri, 11 Feb 2011 14:28:21 +0100] INFO: Backing up current file at C:/df/bin/win
scp.exe
[Fri, 11 Feb 2011 14:28:28 +0100] INFO: Chef Run complete in 25.121094 seconds
[Fri, 11 Feb 2011 14:28:28 +0100] INFO: cleaning the checksum cache
[Fri, 11 Feb 2011 14:28:28 +0100] INFO: Running report handlers
[Fri, 11 Feb 2011 14:28:28 +0100] INFO: Report handlers complete

Any ideas, what is wrong?

We tracked this down. Chef needs to open the files in the cache in binary mode when it computes the checksums. Currently, it does not, so it computes an incorrect checksum for the files and consequently believes there's an updated version on the server.

Dan DeLeo

Wiadomość napisana przez Grzegorz Marszałek w dniu 2011-02-11, o godz. 14:29:

Hello!

Problem:
each time I run chef-client winscp.exe file is downloaded. It's about 6MB.

The same problem is if you use remote_file/remote_directory under windows.

I've created ticket along with possible solution:

http://tickets.opscode.com/browse/CHEF-2046

Cheers

Grzegorz Marszałek
graf0@post.pl