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:
parent
f5ee8b8b7d
commit
ca3cb385d4
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue