fix ftp push check bug

list method is not safe to check if a dir exist or not on remote.
This commit is contained in:
wucheng 2015-04-02 14:44:11 +08:00
parent f5ee8b8b7d
commit ca3cb385d4
1 changed files with 10 additions and 1 deletions

View File

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