The way I solved this is using two ressources:
1) mount to mount the remote directory
2) remote_directory from the mount point to local point
Note that the mount ressource notifies itself to unmount at end of chef run to avoid mount points staying on the servers.
Ex with remote file:
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