在Windows上使用Chef从SVN下载文件

在Windows上使用Chef从SVN下载文件,svn,chef-infra,chef-windows,Svn,Chef Infra,Chef Windows,我很难让chef从SVN服务器下载我需要在菜谱中使用的文件 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_passwor

我很难让chef从SVN服务器下载我需要在菜谱中使用的文件

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
以下是chef客户端运行的输出:

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
第12行是subversion下载安装程序。不是超级有用的输出-我不知道引擎盖下面发生了什么。它不会在我的系统上的任何地方下载文件-目标目录为空

运行此命令可以正常工作:

svn export -r HEAD http://svnrepourl/path/to/installer.msi --username username --password password C:\chef-repo\cookbooks\common\files

它成功地从服务器下载文件并将其放置在目标位置。现在,我可以在一个execute块中编写这个命令,但是我想用Chef的方法来完成。如何从windows上的SVN repo下载特定文件?

这似乎是Chef中的一个bug,已记录在案

为了弄清楚这一点,我运行了chef client-l debug>log.txt,这使我想到以下几行:

[2014-01-10T09:35:00-05:00] INFO: Processing subversion[download installer] action export (common::svntest line 12)
[2014-01-10T09:35:00-05:00] DEBUG: subversion[download installer] export destination C:\chef-repo\cookbooks\common\files already exists or is a non-empty directory - nothing to do
看起来Chef subversion资源需要一个空目录作为目标。我在OP中指定的目标包含一个文件夹。请注意,svnshell命令的情况并非如此-我能够使用它成功地导出到非空目录

现在,我将简单地使用一个execute资源来获取我需要的文件,并希望Opscode能够解决这个长期存在的bug


特别感谢Chef的IRC社区。

这似乎表明文件下载成功。C:\chef repo\cookbooks\common\文件中有什么内容?您可以使用:debug log运行chef,然后您将看到更多信息,并能够了解chef跳过更新您的资源的原因。我可能应该提到C:\chef repo\cookbooks\common\文件是空的。请注意,错误报告中列出的攻击确实有效,尽管这有点痛苦。