これを解決する方法は、2 つのリソースを使用することです。
1) リモートディレクトリをマウントするためのマウント
2) マウント ポイントからローカル ポイントへの remote_directory
マウント リソースは、マウント ポイントがサーバーにとどまらないように、chef の実行の最後にアンマウントするように自身に通知することに注意してください。
リモートファイルの例:
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