我解决这个问题的方法是使用两个ressources:
1)安装到从安装点安装远程目录
2)remote_directory当地点
注意,安装的ressource通知本身在厨师运行结束时卸载以避免挂载点停留在服务器上。
防爆与远程文件:
share = File::dirname(node['firefox']['http_url'])
filename = File::basename(node['firefox']['http_url'])
ENV['tmpdrive'] = "Z:"
mount "Z:" do
action :mount
device share
username "my_user"
domain "my_domain"
password "xxxxxx"
notifies :umount, "mount[Z:]"
end
# Wrokaround sous win2k3
# batch "copy firefox source" do
# command %Q{xcopy /YZE "Z/#{filename}" "#{ENV['TEMP']}/#{filename}"}.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR)
# notifies :umount, "mount[Z:]", :immediately
# end
remote_file "#{ENV['TEMP']}/#{filename}" do
source "file:///z:/#{filename}"
notifies :umount, "mount[Z:]", :immediately
end
这似乎并不直接相关的厨师。 – coderanger 2014-09-02 18:29:35
您是否手动运行该命令?像'xcopy \\ remote-box \ tmp \ something \ * C:\ temp/s/e'这样的东西是完全有效的,所以你的Chef食谱可能会使用\作为意外的转义字符 – 2014-09-02 22:53:54
@castling。是的,我尝试手动,它的工作。当我在厨师尝试时,我无法做到。 – 2014-09-03 06:42:08