vagrant-sshfs 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +4 -4
- data/RELEASE.txt +15 -3
- data/lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb +36 -10
- data/lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb +25 -0
- data/lib/vagrant-sshfs/cap/host/darwin/sshfs_reverse_mount.rb +171 -0
- data/lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb +1 -9
- data/lib/vagrant-sshfs/errors.rb +4 -0
- data/lib/vagrant-sshfs/plugin.rb +20 -0
- data/lib/vagrant-sshfs/version.rb +1 -1
- data/locales/synced_folder_sshfs.yml +2 -0
- data/test/libvirt/README.txt +4 -1
- data/test/misc/README.txt +15 -8
- data/test/misc/Vagrantfile +8 -4
- data/test/misc/dotests.sh +10 -6
- data/test/virtualbox/README.txt +4 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e143084a7768bace31ec459ae109ee5ccf28c7d2
|
4
|
+
data.tar.gz: 3e24221afc2606cbee0bde74375533a5f4e9e753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41a384e958c32f8dff2d5382ae2e98ceced18af213967f3709d8310fc103ea08b00394a5c5e20ed83cb7399739caca4d5227e8ec199fa6ab2f4daf5949cfbb46
|
7
|
+
data.tar.gz: 313b0fa48db0015bb8862918975a5d090af0e42324ce93aff202d1cd5a840b759f5e331f74ad24495e5a6f2ab3ebc2cf569d3dfd0ed1995e173f5ce89b2eb993
|
data/README.adoc
CHANGED
@@ -50,8 +50,8 @@ folder plugin from the Vagrant core code and molding it to fit SSHFS.
|
|
50
50
|
[[modes-of-operation]]
|
51
51
|
== Modes of Operation
|
52
52
|
|
53
|
-
[[sharing-vagrant-host-directory-to-vagrant-guest---
|
54
|
-
=== Sharing Vagrant Host Directory to Vagrant Guest -
|
53
|
+
[[sharing-vagrant-host-directory-to-vagrant-guest---94-of-users]]
|
54
|
+
=== Sharing Vagrant Host Directory to Vagrant Guest - 94% of users
|
55
55
|
|
56
56
|
This plugin uses SSHFS slave mounts (see
|
57
57
|
https://github.com/dustymabe/vagrant-sshfs/issues/11[link]) to mount a
|
@@ -75,8 +75,8 @@ See link:#options-specific-to-arbitrary-host-mounting[Options] and
|
|
75
75
|
link:#appendix-a-using-keys-and-forwarding-ssh-agent[Appendix A] for
|
76
76
|
more information.
|
77
77
|
|
78
|
-
[[sharing-vagrant-guest-directory-to-vagrant-host---
|
79
|
-
=== Sharing Vagrant Guest Directory to Vagrant Host -
|
78
|
+
[[sharing-vagrant-guest-directory-to-vagrant-host---5-of-users]]
|
79
|
+
=== Sharing Vagrant Guest Directory to Vagrant Host - 5% of users
|
80
80
|
|
81
81
|
_NOTE:_ This option is dangerous as data will be destroyed upon
|
82
82
|
`vagrant destroy`
|
data/RELEASE.txt
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
|
2
|
-
Make sure to bump version and commit
|
3
2
|
|
4
|
-
|
3
|
+
# Run viv tests
|
4
|
+
cd /guests/sharedfolder/code/github.com/dustymabe/vagrant-sshfs/test/libvirt
|
5
|
+
vagrant up
|
6
|
+
follow README for running tests
|
5
7
|
|
6
|
-
|
8
|
+
# Make sure to bump version in lib/vagrant-sshfs/version.rb and commit
|
9
|
+
# DO NOT TAG YET
|
10
|
+
|
11
|
+
|
12
|
+
# Craft a commit message for the tag. View the commit message for
|
13
|
+
a previous tag by running: git tag -l -n100 v1.2.1
|
7
14
|
|
8
15
|
-> In vim add thanks to contributors - grab info with
|
9
16
|
git log --no-merges --pretty=format:"%h - %an - %s"
|
@@ -16,6 +23,11 @@ git-evtag sign v1.2.0
|
|
16
23
|
|
17
24
|
-> In vim add release message - see previous tag for example
|
18
25
|
|
26
|
+
# After crafting message then install git-evtag and sign
|
27
|
+
|
28
|
+
git-evtag sign vX.X.X
|
29
|
+
|
30
|
+
|
19
31
|
close and type in password for signing
|
20
32
|
|
21
33
|
verify with git-evtag verify v1.2.0
|
@@ -18,13 +18,23 @@ module VagrantPlugins
|
|
18
18
|
|
19
19
|
def self.sshfs_forward_is_folder_mounted(machine, opts)
|
20
20
|
mounted = false
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
guest_path = opts[:guestpath]
|
22
|
+
|
23
|
+
# If the path doesn't exist at all in the machine then we
|
24
|
+
# can safely say it is not mounted
|
25
|
+
exists = machine.communicate.test("test -e #{guest_path}")
|
26
|
+
return false unless exists
|
27
|
+
|
28
|
+
# find the absolute path so that we can properly check if it is mounted
|
29
|
+
# https://github.com/dustymabe/vagrant-sshfs/issues/44
|
30
|
+
absolute_guest_path = machine.guest.capability(
|
31
|
+
:sshfs_get_absolute_path, guest_path)
|
32
|
+
|
33
|
+
# consult /proc/mounts to see if it is mounted or not
|
24
34
|
machine.communicate.execute("cat /proc/mounts") do |type, data|
|
25
35
|
if type == :stdout
|
26
36
|
data.each_line do |line|
|
27
|
-
if line.split()[1] ==
|
37
|
+
if line.split()[1] == absolute_guest_path
|
28
38
|
mounted = true
|
29
39
|
break
|
30
40
|
end
|
@@ -105,7 +115,7 @@ module VagrantPlugins
|
|
105
115
|
|
106
116
|
protected
|
107
117
|
|
108
|
-
def self.windows_uninherit_handles
|
118
|
+
def self.windows_uninherit_handles(machine)
|
109
119
|
# For win32-process Process.create, if we pass any file handles to the
|
110
120
|
# underlying process for stdin/stdout/stderr then all file handles are
|
111
121
|
# inherited by default. We'll explicitly go through and set all Handles
|
@@ -114,12 +124,27 @@ module VagrantPlugins
|
|
114
124
|
# https://github.com/djberg96/win32-process/blob/6b380f450aebb69d44bb7accd958ecb6b9e1d246/lib/win32/process.rb#L445-L447
|
115
125
|
# bInheritHandles from https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
|
116
126
|
#
|
127
|
+
# In 6f285cd we made it so that we would uninherit all filehandles by
|
128
|
+
# default on windows. Some users have reported that this operation
|
129
|
+
# is erroring because `The parameter is incorrect.`. See #52
|
130
|
+
# We will make the uninheriting operation best effort. The rationale
|
131
|
+
# is that if a file handle was not able to be set to uninheritable
|
132
|
+
# then it probably wasn't one that would get inherited in the first place.
|
133
|
+
#
|
117
134
|
# For each open IO object
|
118
135
|
ObjectSpace.each_object(IO) do |io|
|
119
136
|
if !io.closed?
|
120
137
|
fileno = io.fileno
|
121
138
|
@@logger.debug("Setting file handle #{fileno} to not be inherited")
|
122
|
-
|
139
|
+
begin
|
140
|
+
self.windows_uninherit_handle(fileno)
|
141
|
+
rescue SystemCallError => error
|
142
|
+
msg = "Warning: couldn't set file handle #{fileno} to not be inherited\n"
|
143
|
+
msg+= "Message: " + error.message + "\n"
|
144
|
+
msg+= "Continuing in best effort...."
|
145
|
+
machine.ui.warn(msg)
|
146
|
+
@@logger.warn(msg)
|
147
|
+
end
|
123
148
|
end
|
124
149
|
end
|
125
150
|
end
|
@@ -129,7 +154,8 @@ module VagrantPlugins
|
|
129
154
|
# module by calling For each open IO object. Much of this code was copied from
|
130
155
|
# that module. We access the private methods by using the object.send(:method, args)
|
131
156
|
# technique. In the future we want to get a patch upstream so we don't need to
|
132
|
-
# access
|
157
|
+
# access private methods. Upstream request is here:
|
158
|
+
# https://github.com/djberg96/win32-process/pulls
|
133
159
|
|
134
160
|
# Get the windows IO handle and make sure we were successful getting it
|
135
161
|
handle = Process.send(:get_osfhandle, fileno)
|
@@ -147,8 +173,8 @@ module VagrantPlugins
|
|
147
173
|
# won't get shared by default. See:
|
148
174
|
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms724935(v=vs.85).aspx
|
149
175
|
#
|
150
|
-
bool = Process.send(:SetHandleInformation,
|
151
|
-
|
176
|
+
bool = Process.send(:SetHandleInformation, handle,
|
177
|
+
Process::Constants::HANDLE_FLAG_INHERIT, 0)
|
152
178
|
raise SystemCallError.new("SetHandleInformation", FFI.errno) unless bool
|
153
179
|
end
|
154
180
|
|
@@ -224,7 +250,7 @@ module VagrantPlugins
|
|
224
250
|
# For windows we need to set it so not all file handles are inherited
|
225
251
|
# by default. See https://github.com/dustymabe/vagrant-sshfs/issues/41
|
226
252
|
# The r1,r2,w1,w2,f1,f2 we pass below will get set back to be shared
|
227
|
-
self.windows_uninherit_handles
|
253
|
+
self.windows_uninherit_handles(machine)
|
228
254
|
# For windows, we are using win32-process' Process.create because ruby
|
229
255
|
# doesn't properly detach processes. See https://github.com/dustymabe/vagrant-sshfs/issues/31
|
230
256
|
Process.create(:command_line => sftp_server_cmd,
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestLinux
|
3
|
+
module Cap
|
4
|
+
class SSHFSGetAbsolutePath
|
5
|
+
def self.sshfs_get_absolute_path(machine, path)
|
6
|
+
abs_path = ""
|
7
|
+
machine.communicate.execute("readlink -f #{path}") do |type, data|
|
8
|
+
if type == :stdout
|
9
|
+
abs_path = data
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
if ! abs_path
|
14
|
+
# If no real absolute path was detected then error out
|
15
|
+
error_class = VagrantPlugins::SyncedFolderSSHFS::Errors::SSHFSGetAbsolutePathFailed
|
16
|
+
raise error_class, path: path
|
17
|
+
end
|
18
|
+
|
19
|
+
# Chomp the string so that any trailing newlines are killed
|
20
|
+
return abs_path.chomp
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,171 @@
|
|
1
|
+
require "log4r"
|
2
|
+
require "vagrant/util/retryable"
|
3
|
+
require "tempfile"
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module HostDarwin
|
7
|
+
module Cap
|
8
|
+
class MountSSHFS
|
9
|
+
extend Vagrant::Util::Retryable
|
10
|
+
@@logger = Log4r::Logger.new("vagrant::synced_folders::sshfs_reverse_mount")
|
11
|
+
|
12
|
+
def self.sshfs_reverse_is_folder_mounted(env, opts)
|
13
|
+
mounted = false
|
14
|
+
hostpath = opts[:hostpath].dup
|
15
|
+
hostpath.gsub!("'", "'\\\\''")
|
16
|
+
hostpath = hostpath.chomp('/') # remove trailing / if exists
|
17
|
+
hostpath = File.expand_path(hostpath) # get the absolute path of the file
|
18
|
+
mount_cmd = Vagrant::Util::Which.which('mount')
|
19
|
+
result = Vagrant::Util::Subprocess.execute(mount_cmd)
|
20
|
+
result.stdout.each_line do |line|
|
21
|
+
if line.split()[2] == hostpath
|
22
|
+
mounted = true
|
23
|
+
break
|
24
|
+
end
|
25
|
+
end
|
26
|
+
return mounted
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.sshfs_reverse_mount_folder(env, machine, opts)
|
30
|
+
# opts contains something like:
|
31
|
+
# { :type=>:sshfs,
|
32
|
+
# :guestpath=>"/sharedfolder",
|
33
|
+
# :hostpath=>"/guests/sharedfolder",
|
34
|
+
# :disabled=>false
|
35
|
+
# :ssh_host=>"192.168.1.1"
|
36
|
+
# :ssh_port=>"22"
|
37
|
+
# :ssh_username=>"username"
|
38
|
+
# :ssh_password=>"password"
|
39
|
+
# }
|
40
|
+
self.sshfs_mount(machine, opts)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.sshfs_reverse_unmount_folder(env, machine, opts)
|
44
|
+
self.sshfs_unmount(machine, opts)
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
|
49
|
+
# Perform a mount by running an sftp-server on the vagrant host
|
50
|
+
# and piping stdin/stdout to sshfs running inside the guest
|
51
|
+
def self.sshfs_mount(machine, opts)
|
52
|
+
|
53
|
+
sshfs_path = Vagrant::Util::Which.which('sshfs')
|
54
|
+
|
55
|
+
# expand the guest path so we can handle things like "~/vagrant"
|
56
|
+
expanded_guest_path = machine.guest.capability(
|
57
|
+
:shell_expand_guest_path, opts[:guestpath])
|
58
|
+
|
59
|
+
# Mount path information
|
60
|
+
hostpath = opts[:hostpath].dup
|
61
|
+
hostpath.gsub!("'", "'\\\\''")
|
62
|
+
|
63
|
+
# Add in some sshfs/fuse options that are common to both mount methods
|
64
|
+
opts[:sshfs_opts] = ' -o noauto_cache '# disable caching based on mtime
|
65
|
+
|
66
|
+
# Add in some ssh options that are common to both mount methods
|
67
|
+
opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
|
68
|
+
opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives
|
69
|
+
|
70
|
+
# SSH connection options
|
71
|
+
# Note the backslash escapes for IdentityFile - handles spaces in key path
|
72
|
+
ssh_opts = opts[:ssh_opts]
|
73
|
+
ssh_opts+= ' -o Port=' + machine.ssh_info[:port].to_s
|
74
|
+
ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""'
|
75
|
+
ssh_opts+= ' -o UserKnownHostsFile=/dev/null '
|
76
|
+
ssh_opts+= ' -F /dev/null ' # Don't pick up options from user's config
|
77
|
+
|
78
|
+
ssh_opts_append = opts[:ssh_opts_append].to_s # provided by user
|
79
|
+
|
80
|
+
# SSHFS executable options
|
81
|
+
sshfs_opts = opts[:sshfs_opts]
|
82
|
+
sshfs_opts_append = opts[:sshfs_opts_append].to_s # provided by user
|
83
|
+
|
84
|
+
username = machine.ssh_info[:username]
|
85
|
+
host = machine.ssh_info[:host]
|
86
|
+
|
87
|
+
|
88
|
+
# The sshfs command to mount the guest directory on the host
|
89
|
+
sshfs_cmd = "#{sshfs_path} #{ssh_opts} #{ssh_opts_append} "
|
90
|
+
sshfs_cmd+= "#{sshfs_opts} #{sshfs_opts_append} "
|
91
|
+
sshfs_cmd+= "#{username}@#{host}:#{expanded_guest_path} #{hostpath}"
|
92
|
+
|
93
|
+
# Log some information
|
94
|
+
@@logger.debug("sshfs cmd: #{sshfs_cmd}")
|
95
|
+
|
96
|
+
machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_mounting_folder",
|
97
|
+
hostpath: hostpath, guestpath: expanded_guest_path))
|
98
|
+
|
99
|
+
# Log STDERR to predictable files so that we can inspect them
|
100
|
+
# later in case things go wrong. We'll use the machines data
|
101
|
+
# directory (i.e. .vagrant/machines/default/virtualbox/) for this
|
102
|
+
f1path = machine.data_dir.join('vagrant_sshfs_sshfs_stderr.txt')
|
103
|
+
f1 = File.new(f1path, 'w+')
|
104
|
+
|
105
|
+
# Launch sshfs command to mount guest dir into the host
|
106
|
+
if Vagrant::Util::Platform.windows?
|
107
|
+
# Need to handle Windows differently. Kernel.spawn fails to work,
|
108
|
+
# if the shell creating the process is closed.
|
109
|
+
# See https://github.com/dustymabe/vagrant-sshfs/issues/31
|
110
|
+
Process.create(:command_line => ssh_cmd,
|
111
|
+
:creation_flags => Process::DETACHED_PROCESS,
|
112
|
+
:process_inherit => false,
|
113
|
+
:thread_inherit => true,
|
114
|
+
:startup_info => {:stdin => w2, :stdout => r1, :stderr => f1})
|
115
|
+
else
|
116
|
+
p1 = spawn(sshfs_cmd, :out => f1, :err => f1, :pgroup => true)
|
117
|
+
Process.detach(p1) # Detach so process will keep running
|
118
|
+
end
|
119
|
+
|
120
|
+
# Check that the mount made it
|
121
|
+
mounted = false
|
122
|
+
for i in 0..6
|
123
|
+
machine.ui.info("Checking Mount..")
|
124
|
+
if self.sshfs_reverse_is_folder_mounted(machine, opts)
|
125
|
+
mounted = true
|
126
|
+
break
|
127
|
+
end
|
128
|
+
sleep(2)
|
129
|
+
end
|
130
|
+
if !mounted
|
131
|
+
f1.rewind # Seek to beginning of the file
|
132
|
+
error_class = VagrantPlugins::SyncedFolderSSHFS::Errors::SSHFSReverseMountFailed
|
133
|
+
raise error_class, sshfs_output: f1.read
|
134
|
+
end
|
135
|
+
machine.ui.info("Folder Successfully Mounted!")
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.sshfs_unmount(machine, opts)
|
139
|
+
# opts contains something like:
|
140
|
+
# { :type=>:sshfs,
|
141
|
+
# :guestpath=>"/sharedfolder",
|
142
|
+
# :hostpath=>"/guests/sharedfolder",
|
143
|
+
# :disabled=>false
|
144
|
+
# :ssh_host=>"192.168.1.1"
|
145
|
+
# :ssh_port=>"22"
|
146
|
+
# :ssh_username=>"username"
|
147
|
+
# :ssh_password=>"password"
|
148
|
+
# }
|
149
|
+
|
150
|
+
# Mount path information
|
151
|
+
hostpath = opts[:hostpath].dup
|
152
|
+
hostpath.gsub!("'", "'\\\\''")
|
153
|
+
|
154
|
+
# Log some information
|
155
|
+
machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_unmounting_folder",
|
156
|
+
hostpath: hostpath))
|
157
|
+
|
158
|
+
# Build up the command and connect
|
159
|
+
# on linux it is fusermount -u, on mac it is just umount
|
160
|
+
error_class = VagrantPlugins::SyncedFolderSSHFS::Errors::SSHFSUnmountFailed
|
161
|
+
umount_cmd = Vagrant::Util::Which.which('umount')
|
162
|
+
cmd = "#{umount_cmd} #{hostpath}"
|
163
|
+
result = Vagrant::Util::Subprocess.execute(*cmd.split())
|
164
|
+
if result.exit_code != 0
|
165
|
+
raise error_class, command: cmd, stdout: result.stdout, stderr: result.stderr
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
end
|
@@ -2,13 +2,6 @@ require "log4r"
|
|
2
2
|
require "vagrant/util/retryable"
|
3
3
|
require "tempfile"
|
4
4
|
|
5
|
-
# This is already done for us in lib/vagrant-sshfs.rb. We needed to
|
6
|
-
# do it there before Process.uid is called the first time by Vagrant
|
7
|
-
# This provides a new Process.create() that works on Windows.
|
8
|
-
if Vagrant::Util::Platform.windows?
|
9
|
-
require 'win32/process'
|
10
|
-
end
|
11
|
-
|
12
5
|
module VagrantPlugins
|
13
6
|
module HostLinux
|
14
7
|
module Cap
|
@@ -21,8 +14,7 @@ module VagrantPlugins
|
|
21
14
|
hostpath = opts[:hostpath].dup
|
22
15
|
hostpath.gsub!("'", "'\\\\''")
|
23
16
|
hostpath = hostpath.chomp('/') # remove trailing / if exists
|
24
|
-
|
25
|
-
result = Vagrant::Util::Subprocess.execute(cat_cmd, '/proc/mounts')
|
17
|
+
hostpath = File.expand_path(hostpath) # get the absolute path of the file
|
26
18
|
mounts = File.open('/proc/mounts', 'r')
|
27
19
|
mounts.each_line do |line|
|
28
20
|
if line.split()[1] == hostpath
|
data/lib/vagrant-sshfs/errors.rb
CHANGED
data/lib/vagrant-sshfs/plugin.rb
CHANGED
@@ -35,6 +35,21 @@ module VagrantPlugins
|
|
35
35
|
VagrantPlugins::HostLinux::Cap::MountSSHFS
|
36
36
|
end
|
37
37
|
|
38
|
+
host_capability("darwin", "sshfs_reverse_mount_folder") do
|
39
|
+
require_relative "cap/host/darwin/sshfs_reverse_mount"
|
40
|
+
VagrantPlugins::HostDarwin::Cap::MountSSHFS
|
41
|
+
end
|
42
|
+
|
43
|
+
host_capability("darwin", "sshfs_reverse_unmount_folder") do
|
44
|
+
require_relative "cap/host/darwin/sshfs_reverse_mount"
|
45
|
+
VagrantPlugins::HostDarwin::Cap::MountSSHFS
|
46
|
+
end
|
47
|
+
|
48
|
+
host_capability("darwin", "sshfs_reverse_is_folder_mounted") do
|
49
|
+
require_relative "cap/host/darwin/sshfs_reverse_mount"
|
50
|
+
VagrantPlugins::HostDarwin::Cap::MountSSHFS
|
51
|
+
end
|
52
|
+
|
38
53
|
guest_capability("linux", "sshfs_forward_mount_folder") do
|
39
54
|
require_relative "cap/guest/linux/sshfs_forward_mount"
|
40
55
|
VagrantPlugins::GuestLinux::Cap::MountSSHFS
|
@@ -50,6 +65,11 @@ module VagrantPlugins
|
|
50
65
|
VagrantPlugins::GuestLinux::Cap::MountSSHFS
|
51
66
|
end
|
52
67
|
|
68
|
+
guest_capability("linux", "sshfs_get_absolute_path") do
|
69
|
+
require_relative "cap/guest/linux/sshfs_get_absolute_path"
|
70
|
+
VagrantPlugins::GuestLinux::Cap::SSHFSGetAbsolutePath
|
71
|
+
end
|
72
|
+
|
53
73
|
guest_capability("redhat", "sshfs_installed") do
|
54
74
|
require_relative "cap/guest/redhat/sshfs_client"
|
55
75
|
VagrantPlugins::GuestRedHat::Cap::SSHFSClient
|
@@ -35,6 +35,8 @@ en:
|
|
35
35
|
try again.
|
36
36
|
sshfs_not_in_guest: |-
|
37
37
|
The necessary SSHFS software is not installed in the guest.
|
38
|
+
get_absolute_path_failed: |-
|
39
|
+
Could not get the absolute path of the folder within the guest '%{path}'
|
38
40
|
install_failed_arch: |-
|
39
41
|
The install of the sshfs client software failed. On Arch this is most likely
|
40
42
|
because the package lists are not up to date [1] and partial upgrades are not
|
data/test/libvirt/README.txt
CHANGED
@@ -10,7 +10,7 @@ vagrant ssh
|
|
10
10
|
and then:
|
11
11
|
|
12
12
|
cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/
|
13
|
-
gem install bundler
|
13
|
+
gem install bundler # see [2]
|
14
14
|
bundle install --with plugins # see [1]
|
15
15
|
bundle exec rake featuretests
|
16
16
|
|
@@ -18,3 +18,6 @@ bundle exec rake featuretests
|
|
18
18
|
the vagrant-sshfs line in Gemfile because it errored out
|
19
19
|
complaining about it being defined twice. Running with
|
20
20
|
1.12.5 works fine.
|
21
|
+
[2] because of [1] need to use this instead:
|
22
|
+
gem install bundler --version 1.12.5
|
23
|
+
|
data/test/misc/README.txt
CHANGED
@@ -13,17 +13,24 @@ export THIRD_PARTY_HOST='192.168.121.73'
|
|
13
13
|
export THIRD_PARTY_HOST_USER='vagrant'
|
14
14
|
export THIRD_PARTY_HOST_PASS='vagrant'
|
15
15
|
|
16
|
-
# Next vagrant up - will do
|
16
|
+
# Next vagrant up - will do 4 mounts
|
17
|
+
# - slave
|
18
|
+
# - slave with sym link
|
19
|
+
# - normal
|
20
|
+
# - reverse
|
17
21
|
vagrant up
|
18
22
|
|
19
23
|
# Next run the script to test the mounts:
|
20
24
|
$ bash dotests.sh
|
21
|
-
Testing
|
22
|
-
|
23
|
-
Testing slave mount!
|
24
|
-
|
25
|
+
Testing slave forward mount!
|
26
|
+
d635332fe7aa4d4fb48e5cb9357bdedf
|
27
|
+
Testing slave forward mount with a symlink!
|
28
|
+
d635332fe7aa4d4fb48e5cb9357bdedf
|
29
|
+
Testing normal forward mount!
|
30
|
+
6ccc3034df924bd289dd16205bf3d629
|
25
31
|
Testing reverse mount!
|
26
|
-
508619e7e68e446c84d1fcdf7e0dc577
|
32
|
+
508619e7e68e446c84d1fcdf7e0dc577
|
27
33
|
|
28
|
-
# We are printing out the machine-id under each mount
|
29
|
-
|
34
|
+
# We are printing out the machine-id under each mount. The first two
|
35
|
+
should be the same, because they are from the same machine. The last
|
36
|
+
two should be different.
|
data/test/misc/Vagrantfile
CHANGED
@@ -2,6 +2,14 @@ Vagrant.configure(2) do |config|
|
|
2
2
|
|
3
3
|
config.ssh.insert_key = 'true'
|
4
4
|
|
5
|
+
# Test a forward slave mount:
|
6
|
+
# mounting /etc/ from the vagrant host into the guest
|
7
|
+
config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc/", type: "sshfs"
|
8
|
+
|
9
|
+
# Test a forward mount to a location that is a symbolic link
|
10
|
+
# https://github.com/dustymabe/vagrant-sshfs/issues/44
|
11
|
+
config.vm.synced_folder "/etc/", "/sbin/forward_slave_mount_sym_link_test/", type: "sshfs"
|
12
|
+
|
5
13
|
# Test a forward normal mount:
|
6
14
|
# mounting a folder from a 3rd party host into guest
|
7
15
|
config.vm.synced_folder "/etc/", "/tmp/forward_normal_mount_etc/", type: "sshfs",
|
@@ -9,10 +17,6 @@ Vagrant.configure(2) do |config|
|
|
9
17
|
ssh_username: ENV['THIRD_PARTY_HOST_USER'],
|
10
18
|
ssh_password: ENV['THIRD_PARTY_HOST_PASS']
|
11
19
|
|
12
|
-
# Test a forward slave mount:
|
13
|
-
# mounting /etc/ from the vagrant host into the guest
|
14
|
-
config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc/", type: "sshfs"
|
15
|
-
|
16
20
|
# Test a reverse mount:
|
17
21
|
# mounting /etc/ from vagrant guest into vagrant host
|
18
22
|
config.vm.synced_folder "/tmp/reverse_mount_etc/", "/etc", type: "sshfs", reverse: true
|
data/test/misc/dotests.sh
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
#!/bin/bash
|
2
2
|
set -eu
|
3
3
|
|
4
|
-
# Test the
|
4
|
+
# Test the four mounts we have done
|
5
5
|
|
6
|
-
echo "Testing
|
7
|
-
vagrant ssh -- cat /tmp/forward_normal_mount_etc/machine-id
|
8
|
-
|
9
|
-
echo "Testing slave mount!"
|
6
|
+
echo -en "Testing slave forward mount!\n\t"
|
10
7
|
vagrant ssh -- cat /tmp/forward_slave_mount_etc/machine-id
|
11
8
|
|
12
|
-
|
9
|
+
# https://github.com/dustymabe/vagrant-sshfs/issues/44
|
10
|
+
echo -en "Testing slave forward mount with a symlink!\n\t"
|
11
|
+
vagrant ssh -- cat /usr/sbin/forward_slave_mount_sym_link_test/machine-id
|
12
|
+
|
13
|
+
echo -en "Testing normal forward mount!\n\t"
|
14
|
+
vagrant ssh -- cat /tmp/forward_normal_mount_etc/machine-id
|
15
|
+
|
16
|
+
echo -en "Testing reverse mount!\n\t"
|
13
17
|
cat /tmp/reverse_mount_etc/machine-id
|
data/test/virtualbox/README.txt
CHANGED
@@ -12,7 +12,7 @@ vagrant ssh
|
|
12
12
|
and then:
|
13
13
|
|
14
14
|
cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/
|
15
|
-
gem install bundler
|
15
|
+
gem install bundler # see [2]
|
16
16
|
bundle install --with plugins # see [1]
|
17
17
|
bundle exec rake featuretests
|
18
18
|
|
@@ -20,3 +20,6 @@ bundle exec rake featuretests
|
|
20
20
|
the vagrant-sshfs line in Gemfile because it errored out
|
21
21
|
complaining about it being defined twice. Running with
|
22
22
|
1.12.5 works fine.
|
23
|
+
[2] because of [1] need to use this instead:
|
24
|
+
gem install bundler --version 1.12.5
|
25
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-sshfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dusty Mabe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: win32-process
|
@@ -118,8 +118,10 @@ files:
|
|
118
118
|
- lib/vagrant-sshfs/cap/guest/fedora/sshfs_client.rb
|
119
119
|
- lib/vagrant-sshfs/cap/guest/linux/sshfs_client.rb
|
120
120
|
- lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
|
121
|
+
- lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
|
121
122
|
- lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb
|
122
123
|
- lib/vagrant-sshfs/cap/guest/suse/sshfs_client.rb
|
124
|
+
- lib/vagrant-sshfs/cap/host/darwin/sshfs_reverse_mount.rb
|
123
125
|
- lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb
|
124
126
|
- lib/vagrant-sshfs/command.rb
|
125
127
|
- lib/vagrant-sshfs/errors.rb
|