Improve check for whether we should warm up the cache or not
This commit is contained in:
parent
03a08d09aa
commit
4a3d9547c1
1 changed files with 2 additions and 8 deletions
|
@ -50,8 +50,7 @@ module VagrantPlugins
|
||||||
comm.execute("mkdir -p #{bucket_path}")
|
comm.execute("mkdir -p #{bucket_path}")
|
||||||
unless symlink?(guest_path)
|
unless symlink?(guest_path)
|
||||||
comm.sudo("mkdir -p `dirname #{guest_path}`") if create_parent
|
comm.sudo("mkdir -p `dirname #{guest_path}`") if create_parent
|
||||||
# Bucket is empty and guest path exists
|
if empty_dir?(bucket_path) && !empty_dir?(guest_path)
|
||||||
if empty_dir?(bucket_path) && directory?(guest_path)
|
|
||||||
# Warm up cache with guest machine data
|
# Warm up cache with guest machine data
|
||||||
comm.sudo("shopt -s dotglob && mv #{guest_path}/* #{bucket_path}")
|
comm.sudo("shopt -s dotglob && mv #{guest_path}/* #{bucket_path}")
|
||||||
end
|
end
|
||||||
|
@ -68,8 +67,7 @@ module VagrantPlugins
|
||||||
comm.execute("mkdir -p #{bucket_path}")
|
comm.execute("mkdir -p #{bucket_path}")
|
||||||
unless symlink?(guest_path)
|
unless symlink?(guest_path)
|
||||||
comm.execute("mkdir -p `dirname #{guest_path}`")
|
comm.execute("mkdir -p `dirname #{guest_path}`")
|
||||||
# Bucket is empty and guest path exists
|
if empty_dir?(bucket_path) && !empty_dir?(guest_path)
|
||||||
if empty_dir?(bucket_path) && directory?(guest_path)
|
|
||||||
# Warm up cache with guest machine data
|
# Warm up cache with guest machine data
|
||||||
comm.execute("shopt -s dotglob && mv #{guest_path}/* #{bucket_path}")
|
comm.execute("shopt -s dotglob && mv #{guest_path}/* #{bucket_path}")
|
||||||
end
|
end
|
||||||
|
@ -85,10 +83,6 @@ module VagrantPlugins
|
||||||
def symlink?(path)
|
def symlink?(path)
|
||||||
comm.test("test -L #{path}")
|
comm.test("test -L #{path}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def directory?(path)
|
|
||||||
comm.test("test -d #{path}")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue