Use a hash for directory lookups
This commit is contained in:
parent
a27e7e106a
commit
76e7a980a8
|
@ -106,7 +106,7 @@ module VagrantPlugins
|
||||||
def initialize(*)
|
def initialize(*)
|
||||||
require "net/sftp"
|
require "net/sftp"
|
||||||
super
|
super
|
||||||
@dirs = []
|
@dirs = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_port
|
def default_port
|
||||||
|
@ -125,16 +125,18 @@ module VagrantPlugins
|
||||||
|
|
||||||
fullpath = Pathname.new(dir)
|
fullpath = Pathname.new(dir)
|
||||||
fullpath.descend do |path|
|
fullpath.descend do |path|
|
||||||
if !@dirs.include?(path.to_s)
|
if @dirs[path.to_s].nil?
|
||||||
@dirs.push(path.to_s) # Cache visited directories in a list to avoid duplicate requests
|
|
||||||
begin
|
begin
|
||||||
@server.mkdir!(path.to_s)
|
@server.mkdir!(path.to_s)
|
||||||
|
|
||||||
|
# Cache visited directories in a list to avoid duplicate requests
|
||||||
|
@dirs[path.to_s] = true
|
||||||
rescue Net::SFTP::StatusException => e
|
rescue Net::SFTP::StatusException => e
|
||||||
# Directory exists, skip...
|
# Directory exists, skip...
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@server.upload!(local, remote)
|
@server.upload!(local, remote)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue