Do not use ftp.list for checking the existence of a remote directory

This commit is contained in:
Seth Vargo 2015-04-02 10:12:26 -04:00
commit 1b99272b13
2 changed files with 11 additions and 1 deletions

View File

@ -40,6 +40,7 @@ BUG FIXES:
- provisioners/chef-zero: support more chef-zero/local mode attributes [GH-5339] - provisioners/chef-zero: support more chef-zero/local mode attributes [GH-5339]
- provisioners/docker: use docker.com instead of docker.io [GH-5216] - provisioners/docker: use docker.com instead of docker.io [GH-5216]
- pushes/atlas: send additional box metadata [GH-5283] - pushes/atlas: send additional box metadata [GH-5283]
- pushes/ftp: improve check for remote directory existence [GH-5549]
- synced\_folders/rsync: add `IdentitiesOnly=yes` to the rsync command. [GH-5175] - synced\_folders/rsync: add `IdentitiesOnly=yes` to the rsync command. [GH-5175]
- virtualbox/config: fix misleading error message for private_network [GH-5536, GH-5418] - virtualbox/config: fix misleading error message for private_network [GH-5536, GH-5418]

View File

@ -74,7 +74,7 @@ module VagrantPlugins
# Create the parent directories if they does not exist (naive mkdir -p) # Create the parent directories if they does not exist (naive mkdir -p)
fullpath.descend do |path| fullpath.descend do |path|
if @server.list(path.to_s).empty? if !directory_exists?(path.to_s)
@server.mkdir(path.to_s) @server.mkdir(path.to_s)
end end
end end
@ -83,6 +83,15 @@ module VagrantPlugins
@server.putbinaryfile(local, remote) @server.putbinaryfile(local, remote)
end end
def directory_exists?(path)
begin
@server.chdir(path)
return true
rescue Net::FTPPermError
return false
end
end
private private
def pwd def pwd