I'm having trouble getting chef to download a file I need to use in a recipe from an SVN server.
subversion "download installer" do
repository "http://svnrepourl/path/to/installer.msi"
revision "HEAD"
destination "C:\\chef-repo\\cookbooks\\common\\files"
action :export
svn_username "username"
svn_password "password"
end
Here is the output of the chef-client run:
Compiling Cookbooks...
Converging 1 resources
Recipe: common::svntest
* subversion[download installer] action export[2014-01-09T14:41:42-05:00] INFO
: Processing subversion[download installer] action export (common::svntest line
12)
(up to date)
[2014-01-09T14:41:42-05:00] INFO: Chef Run complete in 1.482104 seconds
[2014-01-09T14:41:42-05:00] INFO: Running report handlers
[2014-01-09T14:41:42-05:00] INFO: Report handlers complete
Chef Client finished, 0 resources updated
Line 12 is "subversion "download installer" do". Not super helpful output - I have no idea what's going on under the hood here. It doesn't download the file anywhere on my system - the destination directory is empty.
Running this command works fine:
svn export -r HEAD http://svnrepourl/path/to/installer.msi --username username --password password C:\chef-repo\cookbooks\common\files
It successfully downloads the file from the server and places it in the destination. Now, I can just write this command in an execute block, but I'd like to do this the Chef way. How can I download a specific file from an SVN repo on windows?
Looks like this is a bug in Chef, documented here.
In order to figure this out I ran
chef-client -l debug > log.txt
, which led me to these lines:Looks like the Chef subversion resource requires an empty directory as the destination (the destination I specified in the OP contains a single folder). Note that this is not the case with the svn shell command - I was able to successfully export to a non-empty directory with it.
At this point, I'm going to simply use an execute resource to grab the file I need and hope Opscode gets around to fixing this long-standing bug.
Special thanks to Chef's IRC community.