vagrant-sshfs 1.3.0 → 1.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e143084a7768bace31ec459ae109ee5ccf28c7d2
4
- data.tar.gz: 3e24221afc2606cbee0bde74375533a5f4e9e753
3
+ metadata.gz: 4d157c8505dffb3fd49fc1bf75f22f0941021e4f
4
+ data.tar.gz: d3140fe56a5aaae22881f62a5a3503982979d641
5
5
  SHA512:
6
- metadata.gz: 41a384e958c32f8dff2d5382ae2e98ceced18af213967f3709d8310fc103ea08b00394a5c5e20ed83cb7399739caca4d5227e8ec199fa6ab2f4daf5949cfbb46
7
- data.tar.gz: 313b0fa48db0015bb8862918975a5d090af0e42324ce93aff202d1cd5a840b759f5e331f74ad24495e5a6f2ab3ebc2cf569d3dfd0ed1995e173f5ce89b2eb993
6
+ metadata.gz: 6d2d085b190c1179951d81802a03d847cf3bddceaebbb0d7324eda7d19a0c4b66ff0c55905761590b498ca9bb5f7ad460dd5e8051f4202ae3c4008ea6b126b34
7
+ data.tar.gz: 4426f39f7934c6a7b2e314be8f49924792bc418b6ba522c321f372145869bcd48c33aa3f63d46e65d1adb94a1c0e4ba49ac2e6387b104278a26d825fa8b9bc3c
data/Gemfile CHANGED
@@ -6,12 +6,12 @@ group :development do
6
6
  # We depend on Vagrant for development, but we don't add it as a
7
7
  # gem dependency because we expect to be installed within the
8
8
  # Vagrant environment itself using `vagrant plugin`.
9
- gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :ref => 'v1.8.6'
9
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :ref => 'v2.0.2'
10
10
  end
11
11
 
12
12
  group :plugins do
13
13
  gem "vagrant-sshfs" , path: "."
14
14
  # Add vagrant-libvirt plugin here, otherwise you won't be able to
15
15
  # use libvirt as a provider when you execute `bundle exec vagrant up`
16
- gem "vagrant-libvirt" , '0.0.33'
16
+ gem "vagrant-libvirt" , '0.0.43'
17
17
  end
@@ -44,6 +44,13 @@ gpg --armor --detach-sign pkg/vagrant-sshfs-1.2.0.gem
44
44
  $ ls pkg/vagrant-sshfs-1.2.0.gem*
45
45
  pkg/vagrant-sshfs-1.2.0.gem pkg/vagrant-sshfs-1.2.0.gem.asc
46
46
 
47
+ # make tar.gz and zip files
48
+ git archive --format=tar.gz v1.3.0 > vagrant-sshfs-1.3.0.tar.gz
49
+ gpg --armor --detach-sign vagrant-sshfs-1.3.0.tar.gz
50
+ git archive --format=zip v1.3.0 > vagrant-sshfs-1.3.0.zip
51
+ gpg --armor --detach-sign vagrant-sshfs-1.3.0.zip
52
+
53
+
47
54
  # Update release notes and upload files on github
48
55
 
49
56
  # push to rubygems with:
@@ -3,9 +3,9 @@
3
3
  # human readable. All Gherkin files have a .feature extension
4
4
  #
5
5
  # See more here: https://en.wikipedia.org/wiki/Cucumber_(software)
6
- #
7
- # Additoinally in the setup/env.rb file we set up Aruba. Aruba is used
8
- # to define most of the basic step definitions that we use as part of
6
+ #
7
+ # Additionally in the setup/env.rb file we set up Aruba. Aruba is used
8
+ # to define most of the basic step definitions that we use as part of
9
9
  # the Gherkin syntax in this file.
10
10
  #
11
11
  # For more information on the step definitions provided see:
@@ -21,7 +21,7 @@ Feature: SSHFS mount of vagrant current working directory
21
21
  # Disable the default rsync
22
22
  config.vm.synced_folder '.', '/vagrant', disabled: true
23
23
 
24
- # If using libvirt and nested virt (vagrant in vagrant) then
24
+ # If using libvirt and nested virt (vagrant in vagrant) then
25
25
  # we need to use a different network than 192.168.121.0
26
26
  config.vm.provider :libvirt do |libvirt|
27
27
  libvirt.management_network_name = 'vagrant-libvirt-test'
@@ -42,5 +42,5 @@ Feature: SSHFS mount of vagrant current working directory
42
42
  Examples:
43
43
  | box |
44
44
  | centos/7 |
45
-
46
-
45
+
46
+
@@ -1,6 +1,6 @@
1
- # This is a cucumber step definition. Cucumber scenarios become automated
2
- # tests with the addition of what are called step definitions. A step
3
- # definition is a block of code associated with one or more steps by a
1
+ # This is a cucumber step definition. Cucumber scenarios become automated
2
+ # tests with the addition of what are called step definitions. A step
3
+ # definition is a block of code associated with one or more steps by a
4
4
  # regular expression (or, in simple cases, a string).
5
5
  #
6
6
  # This is the step definition for the `And vagrant current working
@@ -4,8 +4,8 @@ rescue LoadError
4
4
  raise "The Vagrant sshfs plugin must be run within Vagrant"
5
5
  end
6
6
 
7
- # Only load the gem on Windows since it replaces some methods in Ruby's
8
- # Process class. Also load it here before Process.uid is called the first
7
+ # Only load the gem on Windows since it replaces some methods in Ruby's
8
+ # Process class. Also load it here before Process.uid is called the first
9
9
  # time by Vagrant. The Process.create() function actually gets used in
10
10
  # lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
11
11
  if Vagrant::Util::Platform.windows?
@@ -0,0 +1,130 @@
1
+ require "log4r"
2
+
3
+ require "vagrant/action/builtin/mixin_synced_folders"
4
+
5
+ module VagrantPlugins
6
+ module SyncedFolderSSHFS
7
+
8
+ # Class that contains common function that are called by both
9
+ # HostPathFix and HostPathUnfix classes.
10
+ class HostPathFixCommon
11
+
12
+ include Vagrant::Action::Builtin::MixinSyncedFolders
13
+
14
+ def initialize()
15
+ @logger = Log4r::Logger.new("vagrant::synced_folders::sshfs")
16
+ end
17
+
18
+ def fix(data)
19
+ # If this is an arbitrary host mount we need to set the hostpath
20
+ # to something that will pass the config checks that assume the
21
+ # hostpath is coming from the vagrant host and not from an arbitrary
22
+ # host. Save off the original hostpath and then set the hostpath to
23
+ # "." to pass the checks.
24
+ if data[:ssh_host]
25
+ data[:hostpath_orig] = data[:hostpath]
26
+ data[:hostpath] = "."
27
+ end
28
+ end
29
+
30
+ def unfix(data)
31
+ # If this is a reverse mounted folder or an arbitrary host mount
32
+ # then we'll set "hostpath_exact" so they don't try to create a
33
+ # folder on the host in Vagrant::Action::Builtin::SyncedFolders.
34
+ if data[:ssh_host]
35
+ data[:hostpath_exact] = true
36
+ data[:hostpath] = data[:hostpath_orig]
37
+ data.delete(:hostpath_orig)
38
+ end
39
+ end
40
+
41
+ # Loop through synced folder entries and either fix or unfix
42
+ # based on the fix arg
43
+ def loop_and_fix_unfix(env, fix)
44
+
45
+ opts = {
46
+ cached: !!env[:synced_folders_cached],
47
+ config: env[:synced_folders_config],
48
+ }
49
+
50
+ @logger.debug("SyncedFolders loading from cache: #{opts[:cached]}")
51
+ folders = synced_folders(env[:machine], **opts)
52
+
53
+ folders.each do |impl_name, fs|
54
+ next if impl_name != :sshfs
55
+ @logger.debug("Synced Folder Implementation: #{impl_name}")
56
+
57
+ fs.each do |id, data|
58
+
59
+ # replace data with a copy since we may delete/add new data to the config
60
+ data = data.dup
61
+
62
+ if fix
63
+ @logger.debug("fixup host path before: - #{id}: #{data[:hostpath]} => #{data[:guestpath]}")
64
+ fix(data)
65
+ @logger.debug("fixup host path after: - #{id}: #{data[:hostpath]} => #{data[:guestpath]}")
66
+ else
67
+ @logger.debug("unfixup host path before: - #{id}: #{data[:hostpath]} => #{data[:guestpath]}")
68
+ unfix(data)
69
+ @logger.debug("fixup host path after: - #{id}: #{data[:hostpath]} => #{data[:guestpath]}")
70
+ end
71
+
72
+ # Replace the entry in the config with the updated one
73
+ env[:machine].config.vm.synced_folders.delete(id)
74
+ env[:machine].config.vm.synced_folder(
75
+ data[:hostpath],
76
+ data[:guestpath],
77
+ data)
78
+ end
79
+ end
80
+ end
81
+ end
82
+
83
+ # Class that will massage the data for synced folders that are
84
+ # arbitrary host mounts (contain ssh_host in the options) to make
85
+ # it so that "host path checking" isn't performed on the vagrant
86
+ # host machine
87
+ class HostPathFix
88
+
89
+ def initialize(app, env)
90
+ @app = app
91
+ @logger = Log4r::Logger.new("vagrant::synced_folders::sshfs")
92
+ end
93
+
94
+ def call(env)
95
+ classname = "VagrantPlugins::SyncedFolderSSHFS::HostPathFix"
96
+ @logger.debug("Executing hook within #{classname}")
97
+
98
+ # This part is for the IN action call
99
+ HostPathFixCommon.new().loop_and_fix_unfix(env, fix=true)
100
+
101
+ # Now continue until the OUT call
102
+ @app.call(env)
103
+
104
+ end
105
+ end
106
+
107
+
108
+ # Class that will undo the data manipulation that was done in
109
+ # HostPathFix and also set hostpath_exact=true if necessary
110
+ class HostPathUnfix
111
+
112
+ def initialize(app, env)
113
+ @app = app
114
+ @logger = Log4r::Logger.new("vagrant::synced_folders::sshfs")
115
+ end
116
+
117
+ def call(env)
118
+ classname = "VagrantPlugins::SyncedFolderSSHFS::HostPathUnfix"
119
+ @logger.debug("Executing hook within #{classname}")
120
+
121
+ # This part is for the IN action call
122
+ HostPathFixCommon.new().loop_and_fix_unfix(env, fix=false)
123
+
124
+ # Now continue until the OUT call
125
+ @app.call(env)
126
+
127
+ end
128
+ end
129
+ end
130
+ end
@@ -3,6 +3,7 @@ module VagrantPlugins
3
3
  module Cap
4
4
  class SSHFSClient
5
5
  def self.sshfs_install(machine)
6
+ machine.communicate.sudo("apt-get update")
6
7
  machine.communicate.sudo("apt-get install -y sshfs")
7
8
  end
8
9
 
@@ -0,0 +1,22 @@
1
+ module VagrantPlugins
2
+ module GuestFreeBSD
3
+ module Cap
4
+ class SSHFSClient
5
+ def self.sshfs_install(machine)
6
+ machine.communicate.sudo("pkg install -y fusefs-sshfs")
7
+ machine.communicate.sudo("kldload fuse")
8
+ end
9
+
10
+ def self.sshfs_installed(machine)
11
+ installed = machine.communicate.test("pkg info fusefs-sshfs")
12
+ if installed
13
+ # fuse may not get loaded at boot, so check if it's loaded otherwise force load it
14
+ machine.communicate.sudo("kldstat -m fuse || kldload fuse")
15
+ end
16
+
17
+ installed
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ require_relative "../linux/sshfs_forward_mount"
2
+
3
+ module VagrantPlugins
4
+ module GuestFreeBSD
5
+ module Cap
6
+ class MountSSHFS < VagrantPlugins::GuestLinux::Cap::MountSSHFS
7
+ def self.list_mounts_command
8
+ "mount -p"
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,6 @@
1
1
  require "log4r"
2
2
  require "vagrant/util/retryable"
3
+ require "vagrant/util/platform"
3
4
  require "tempfile"
4
5
 
5
6
  # This is already done for us in lib/vagrant-sshfs.rb. We needed to
@@ -16,13 +17,17 @@ module VagrantPlugins
16
17
  extend Vagrant::Util::Retryable
17
18
  @@logger = Log4r::Logger.new("vagrant::synced_folders::sshfs_mount")
18
19
 
20
+ def self.list_mounts_command
21
+ "cat /proc/mounts"
22
+ end
23
+
19
24
  def self.sshfs_forward_is_folder_mounted(machine, opts)
20
25
  mounted = false
21
26
  guest_path = opts[:guestpath]
22
27
 
23
28
  # If the path doesn't exist at all in the machine then we
24
29
  # can safely say it is not mounted
25
- exists = machine.communicate.test("test -e #{guest_path}")
30
+ exists = machine.communicate.test("test -e #{guest_path}", sudo: true)
26
31
  return false unless exists
27
32
 
28
33
  # find the absolute path so that we can properly check if it is mounted
@@ -31,7 +36,7 @@ module VagrantPlugins
31
36
  :sshfs_get_absolute_path, guest_path)
32
37
 
33
38
  # consult /proc/mounts to see if it is mounted or not
34
- machine.communicate.execute("cat /proc/mounts") do |type, data|
39
+ machine.communicate.execute(self.list_mounts_command) do |type, data|
35
40
  if type == :stdout
36
41
  data.each_line do |line|
37
42
  if line.split()[1] == absolute_guest_path
@@ -48,7 +53,7 @@ module VagrantPlugins
48
53
  # opts contains something like:
49
54
  # { :type=>:sshfs,
50
55
  # :guestpath=>"/sharedfolder",
51
- # :hostpath=>"/guests/sharedfolder",
56
+ # :hostpath=>"/guests/sharedfolder",
52
57
  # :disabled=>false
53
58
  # :ssh_host=>"192.168.1.1"
54
59
  # :ssh_port=>"22"
@@ -66,16 +71,23 @@ module VagrantPlugins
66
71
  comm.sudo("chmod 777 #{expanded_guest_path}")
67
72
  end
68
73
 
69
- # Mount path information
70
- hostpath = opts[:hostpath].dup
71
- hostpath.gsub!("'", "'\\\\''")
74
+ # Mount path information: if arbitrary host mounting then
75
+ # take as is. If not, then expand the hostpath to the real
76
+ # path.
77
+ if opts[:ssh_host]
78
+ hostpath = opts[:hostpath].dup
79
+ else
80
+ hostpath = File.expand_path(opts[:hostpath], machine.env.root_path)
81
+ hostpath = Vagrant::Util::Platform.fs_real_path(hostpath).to_s
82
+ end
83
+
72
84
 
73
85
  # Add in some sshfs/fuse options that are common to both mount methods
74
86
  opts[:sshfs_opts] = ' -o allow_other ' # allow non-root users to access
75
87
  opts[:sshfs_opts]+= ' -o noauto_cache '# disable caching based on mtime
76
88
 
77
89
  # Add in some ssh options that are common to both mount methods
78
- opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
90
+ opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
79
91
  opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives
80
92
 
81
93
  # Do a normal mount only if the user provided host information
@@ -116,25 +128,25 @@ module VagrantPlugins
116
128
  protected
117
129
 
118
130
  def self.windows_uninherit_handles(machine)
119
- # For win32-process Process.create, if we pass any file handles to the
120
- # underlying process for stdin/stdout/stderr then all file handles are
131
+ # For win32-process Process.create, if we pass any file handles to the
132
+ # underlying process for stdin/stdout/stderr then all file handles are
121
133
  # inherited by default. We'll explicitly go through and set all Handles
122
134
  # to not be inheritable by default. See following links for more info
123
- #
135
+ #
124
136
  # https://github.com/djberg96/win32-process/blob/6b380f450aebb69d44bb7accd958ecb6b9e1d246/lib/win32/process.rb#L445-L447
125
137
  # bInheritHandles from https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
126
- #
138
+ #
127
139
  # In 6f285cd we made it so that we would uninherit all filehandles by
128
140
  # default on windows. Some users have reported that this operation
129
141
  # 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
142
+ # We will make the uninheriting operation best effort. The rationale
143
+ # is that if a file handle was not able to be set to uninheritable
132
144
  # then it probably wasn't one that would get inherited in the first place.
133
145
  #
134
- # For each open IO object
146
+ # For each open IO object
135
147
  ObjectSpace.each_object(IO) do |io|
136
148
  if !io.closed?
137
- fileno = io.fileno
149
+ fileno = io.fileno
138
150
  @@logger.debug("Setting file handle #{fileno} to not be inherited")
139
151
  begin
140
152
  self.windows_uninherit_handle(fileno)
@@ -151,7 +163,7 @@ module VagrantPlugins
151
163
 
152
164
  def self.windows_uninherit_handle(fileno)
153
165
  # Right now we'll be doing this using private methods from the win32-process
154
- # module by calling For each open IO object. Much of this code was copied from
166
+ # module by calling For each open IO object. Much of this code was copied from
155
167
  # that module. We access the private methods by using the object.send(:method, args)
156
168
  # technique. In the future we want to get a patch upstream so we don't need to
157
169
  # access private methods. Upstream request is here:
@@ -170,15 +182,15 @@ module VagrantPlugins
170
182
  end
171
183
 
172
184
  # Now clear the HANDLE_FLAG_INHERIT from the HANDLE so that the handle
173
- # won't get shared by default. See:
185
+ # won't get shared by default. See:
174
186
  # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724935(v=vs.85).aspx
175
- #
187
+ #
176
188
  bool = Process.send(:SetHandleInformation, handle,
177
189
  Process::Constants::HANDLE_FLAG_INHERIT, 0)
178
190
  raise SystemCallError.new("SetHandleInformation", FFI.errno) unless bool
179
191
  end
180
192
 
181
- # Perform a mount by running an sftp-server on the vagrant host
193
+ # Perform a mount by running an sftp-server on the vagrant host
182
194
  # and piping stdin/stdout to sshfs running inside the guest
183
195
  def self.sshfs_slave_mount(machine, opts, hostpath, expanded_guest_path)
184
196
 
@@ -198,24 +210,35 @@ module VagrantPlugins
198
210
 
199
211
  # The remote sshfs command that will run (in slave mode)
200
212
  sshfs_opts+= ' -o slave '
201
- sshfs_cmd = "sudo -E sshfs :#{hostpath} #{expanded_guest_path}"
213
+ sshfs_cmd = "sudo -E sshfs :#{hostpath} #{expanded_guest_path}"
202
214
  sshfs_cmd+= sshfs_opts + ' ' + sshfs_opts_append + ' '
203
215
 
204
216
  # The ssh command to connect to guest and then launch sshfs
205
- # Note the backslash escapes for IdentityFile - handles spaces in key path
206
217
  ssh_opts = opts[:ssh_opts]
207
218
  ssh_opts+= ' -o User=' + machine.ssh_info[:username]
208
219
  ssh_opts+= ' -o Port=' + machine.ssh_info[:port].to_s
209
- ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""'
210
220
  ssh_opts+= ' -o UserKnownHostsFile=/dev/null '
211
221
  ssh_opts+= ' -F /dev/null ' # Don't pick up options from user's config
222
+ if machine.ssh_info.key?(:private_key_path) and
223
+ machine.ssh_info[:private_key_path] and
224
+ machine.ssh_info[:private_key_path][0]
225
+ # Add IdentityFile since there is one
226
+ # Note the backslash escapes for IdentityFile - handles spaces in key path
227
+ ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""'
228
+ end
229
+
230
+ # Use an SSH ProxyCommand when corresponding Vagrant setting is defined
231
+ if machine.ssh_info[:proxy_command]
232
+ ssh_opts+= " -o ProxyCommand=\"" + machine.ssh_info[:proxy_command] + "\""
233
+ end
234
+
212
235
  ssh_cmd = ssh_path + ssh_opts + ' ' + ssh_opts_append + ' ' + machine.ssh_info[:host]
213
236
  ssh_cmd+= ' "' + sshfs_cmd + '"'
214
237
 
215
238
  # Log some information
216
239
  @@logger.debug("sftp-server cmd: #{sftp_server_cmd}")
217
240
  @@logger.debug("ssh cmd: #{ssh_cmd}")
218
- machine.ui.info(I18n.t("vagrant.sshfs.actions.slave_mounting_folder",
241
+ machine.ui.info(I18n.t("vagrant.sshfs.actions.slave_mounting_folder",
219
242
  hostpath: hostpath, guestpath: expanded_guest_path))
220
243
 
221
244
  # Create two named pipes for communication between sftp-server and
@@ -234,8 +257,8 @@ module VagrantPlugins
234
257
  # The way this works is by hooking up the stdin+stdout of the
235
258
  # sftp-server process to the stdin+stdout of the sshfs process
236
259
  # running inside the guest in slave mode. An illustration is below:
237
- #
238
- # stdout => w1 pipe1 r1 => stdin
260
+ #
261
+ # stdout => w1 pipe1 r1 => stdin
239
262
  # />------------->==============>----------->\
240
263
  # / \
241
264
  # | |
@@ -243,7 +266,7 @@ module VagrantPlugins
243
266
  # | |
244
267
  # \ /
245
268
  # \<-------------<==============<-----------</
246
- # stdin <= r2 pipe2 w2 <= stdout
269
+ # stdin <= r2 pipe2 w2 <= stdout
247
270
  #
248
271
  # Wire up things appropriately and start up the processes
249
272
  if Vagrant::Util::Platform.windows?
@@ -319,13 +342,13 @@ module VagrantPlugins
319
342
  end
320
343
 
321
344
  # Log some information
322
- machine.ui.info(I18n.t("vagrant.sshfs.actions.normal_mounting_folder",
323
- user: username, host: host,
345
+ machine.ui.info(I18n.t("vagrant.sshfs.actions.normal_mounting_folder",
346
+ user: username, host: host,
324
347
  hostpath: hostpath, guestpath: expanded_guest_path))
325
-
348
+
326
349
  # Build up the command and connect
327
350
  error_class = VagrantPlugins::SyncedFolderSSHFS::Errors::SSHFSNormalMountFailed
328
- cmd = echopipe
351
+ cmd = echopipe
329
352
  cmd+= "sshfs -p #{port} "
330
353
  cmd+= ssh_opts + ' ' + ssh_opts_append + ' '
331
354
  cmd+= sshfs_opts + ' ' + sshfs_opts_append + ' '
@@ -4,7 +4,7 @@ module VagrantPlugins
4
4
  class SSHFSGetAbsolutePath
5
5
  def self.sshfs_get_absolute_path(machine, path)
6
6
  abs_path = ""
7
- machine.communicate.execute("readlink -f #{path}") do |type, data|
7
+ machine.communicate.execute("readlink -f #{path}", sudo: true) do |type, data|
8
8
  if type == :stdout
9
9
  abs_path = data
10
10
  end
@@ -3,7 +3,7 @@ module VagrantPlugins
3
3
  module Cap
4
4
  class SSHFSClient
5
5
  def self.sshfs_install(machine)
6
- # Install epel rpm if not installed
6
+ # Install epel rpm if not installed
7
7
  if !epel_installed(machine)
8
8
  epel_install(machine)
9
9
  end
@@ -15,7 +15,7 @@ module VagrantPlugins
15
15
  def self.sshfs_installed(machine)
16
16
  machine.communicate.test("rpm -q fuse-sshfs")
17
17
  end
18
-
18
+
19
19
  protected
20
20
 
21
21
  def self.epel_installed(machine)
@@ -26,7 +26,7 @@ module VagrantPlugins
26
26
  case machine.guest.capability("flavor")
27
27
  when :rhel_7
28
28
  machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm")
29
- when :rhel # rhel6
29
+ when :rhel # rhel6
30
30
  machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm")
31
31
  end
32
32
  end
@@ -30,7 +30,7 @@ module VagrantPlugins
30
30
  # opts contains something like:
31
31
  # { :type=>:sshfs,
32
32
  # :guestpath=>"/sharedfolder",
33
- # :hostpath=>"/guests/sharedfolder",
33
+ # :hostpath=>"/guests/sharedfolder",
34
34
  # :disabled=>false
35
35
  # :ssh_host=>"192.168.1.1"
36
36
  # :ssh_port=>"22"
@@ -46,7 +46,7 @@ module VagrantPlugins
46
46
 
47
47
  protected
48
48
 
49
- # Perform a mount by running an sftp-server on the vagrant host
49
+ # Perform a mount by running an sftp-server on the vagrant host
50
50
  # and piping stdin/stdout to sshfs running inside the guest
51
51
  def self.sshfs_mount(machine, opts)
52
52
 
@@ -64,7 +64,7 @@ module VagrantPlugins
64
64
  opts[:sshfs_opts] = ' -o noauto_cache '# disable caching based on mtime
65
65
 
66
66
  # Add in some ssh options that are common to both mount methods
67
- opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
67
+ opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
68
68
  opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives
69
69
 
70
70
  # SSH connection options
@@ -74,6 +74,13 @@ module VagrantPlugins
74
74
  ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""'
75
75
  ssh_opts+= ' -o UserKnownHostsFile=/dev/null '
76
76
  ssh_opts+= ' -F /dev/null ' # Don't pick up options from user's config
77
+ if machine.ssh_info.key?(:private_key_path) and
78
+ machine.ssh_info[:private_key_path] and
79
+ machine.ssh_info[:private_key_path][0]
80
+ # Add IdentityFile since there is one
81
+ # Note the backslash escapes for IdentityFile - handles spaces in key path
82
+ ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""'
83
+ end
77
84
 
78
85
  ssh_opts_append = opts[:ssh_opts_append].to_s # provided by user
79
86
 
@@ -88,12 +95,12 @@ module VagrantPlugins
88
95
  # The sshfs command to mount the guest directory on the host
89
96
  sshfs_cmd = "#{sshfs_path} #{ssh_opts} #{ssh_opts_append} "
90
97
  sshfs_cmd+= "#{sshfs_opts} #{sshfs_opts_append} "
91
- sshfs_cmd+= "#{username}@#{host}:#{expanded_guest_path} #{hostpath}"
98
+ sshfs_cmd+= "#{username}@#{host}:#{expanded_guest_path} #{hostpath}"
92
99
 
93
100
  # Log some information
94
101
  @@logger.debug("sshfs cmd: #{sshfs_cmd}")
95
102
 
96
- machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_mounting_folder",
103
+ machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_mounting_folder",
97
104
  hostpath: hostpath, guestpath: expanded_guest_path))
98
105
 
99
106
  # Log STDERR to predictable files so that we can inspect them
@@ -104,7 +111,7 @@ module VagrantPlugins
104
111
 
105
112
  # Launch sshfs command to mount guest dir into the host
106
113
  if Vagrant::Util::Platform.windows?
107
- # Need to handle Windows differently. Kernel.spawn fails to work,
114
+ # Need to handle Windows differently. Kernel.spawn fails to work,
108
115
  # if the shell creating the process is closed.
109
116
  # See https://github.com/dustymabe/vagrant-sshfs/issues/31
110
117
  Process.create(:command_line => ssh_cmd,
@@ -29,7 +29,7 @@ module VagrantPlugins
29
29
  # opts contains something like:
30
30
  # { :type=>:sshfs,
31
31
  # :guestpath=>"/sharedfolder",
32
- # :hostpath=>"/guests/sharedfolder",
32
+ # :hostpath=>"/guests/sharedfolder",
33
33
  # :disabled=>false
34
34
  # :ssh_host=>"192.168.1.1"
35
35
  # :ssh_port=>"22"
@@ -45,7 +45,7 @@ module VagrantPlugins
45
45
 
46
46
  protected
47
47
 
48
- # Perform a mount by running an sftp-server on the vagrant host
48
+ # Perform a mount by running an sftp-server on the vagrant host
49
49
  # and piping stdin/stdout to sshfs running inside the guest
50
50
  def self.sshfs_mount(machine, opts)
51
51
 
@@ -63,16 +63,21 @@ module VagrantPlugins
63
63
  opts[:sshfs_opts] = ' -o noauto_cache '# disable caching based on mtime
64
64
 
65
65
  # Add in some ssh options that are common to both mount methods
66
- opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
66
+ opts[:ssh_opts] = ' -o StrictHostKeyChecking=no '# prevent yes/no question
67
67
  opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives
68
68
 
69
69
  # SSH connection options
70
- # Note the backslash escapes for IdentityFile - handles spaces in key path
71
70
  ssh_opts = opts[:ssh_opts]
72
71
  ssh_opts+= ' -o Port=' + machine.ssh_info[:port].to_s
73
- ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""'
74
72
  ssh_opts+= ' -o UserKnownHostsFile=/dev/null '
75
73
  ssh_opts+= ' -F /dev/null ' # Don't pick up options from user's config
74
+ if machine.ssh_info.key?(:private_key_path) and
75
+ machine.ssh_info[:private_key_path] and
76
+ machine.ssh_info[:private_key_path][0]
77
+ # Add IdentityFile since there is one
78
+ # Note the backslash escapes for IdentityFile - handles spaces in key path
79
+ ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""'
80
+ end
76
81
 
77
82
  ssh_opts_append = opts[:ssh_opts_append].to_s # provided by user
78
83
 
@@ -87,12 +92,12 @@ module VagrantPlugins
87
92
  # The sshfs command to mount the guest directory on the host
88
93
  sshfs_cmd = "#{sshfs_path} #{ssh_opts} #{ssh_opts_append} "
89
94
  sshfs_cmd+= "#{sshfs_opts} #{sshfs_opts_append} "
90
- sshfs_cmd+= "#{username}@#{host}:#{expanded_guest_path} #{hostpath}"
95
+ sshfs_cmd+= "#{username}@#{host}:#{expanded_guest_path} #{hostpath}"
91
96
 
92
97
  # Log some information
93
98
  @@logger.debug("sshfs cmd: #{sshfs_cmd}")
94
99
 
95
- machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_mounting_folder",
100
+ machine.ui.info(I18n.t("vagrant.sshfs.actions.reverse_mounting_folder",
96
101
  hostpath: hostpath, guestpath: expanded_guest_path))
97
102
 
98
103
  # Log STDERR to predictable files so that we can inspect them
@@ -103,7 +108,7 @@ module VagrantPlugins
103
108
 
104
109
  # Launch sshfs command to mount guest dir into the host
105
110
  if Vagrant::Util::Platform.windows?
106
- # Need to handle Windows differently. Kernel.spawn fails to work,
111
+ # Need to handle Windows differently. Kernel.spawn fails to work,
107
112
  # if the shell creating the process is closed.
108
113
  # See https://github.com/dustymabe/vagrant-sshfs/issues/31
109
114
  Process.create(:command_line => ssh_cmd,
@@ -20,6 +20,23 @@ module VagrantPlugins
20
20
  Command::SSHFS
21
21
  end
22
22
 
23
+ # The following two hooks allow us to workaround
24
+ # the config validations that assume the hostpaths
25
+ # are coming from our host machine. This is not the
26
+ # case for arbitrary host mounts.
27
+ action_hook("sshfs_hostpath_fixup") do |hook|
28
+ require_relative "action_hostpath_fixup"
29
+ hook.before(
30
+ Vagrant::Action::Builtin::ConfigValidate,
31
+ HostPathFix)
32
+ end
33
+ action_hook("sshfs_hostpath_unfix") do |hook|
34
+ require_relative "action_hostpath_fixup"
35
+ hook.after(
36
+ Vagrant::Action::Builtin::ConfigValidate,
37
+ HostPathUnfix)
38
+ end
39
+
23
40
  host_capability("linux", "sshfs_reverse_mount_folder") do
24
41
  require_relative "cap/host/linux/sshfs_reverse_mount"
25
42
  VagrantPlugins::HostLinux::Cap::MountSSHFS
@@ -120,6 +137,35 @@ module VagrantPlugins
120
137
  VagrantPlugins::GuestSUSE::Cap::SSHFSClient
121
138
  end
122
139
 
140
+ guest_capability("freebsd", "sshfs_forward_mount_folder") do
141
+ require_relative "cap/guest/freebsd/sshfs_forward_mount"
142
+ VagrantPlugins::GuestFreeBSD::Cap::MountSSHFS
143
+ end
144
+
145
+ guest_capability("freebsd", "sshfs_forward_unmount_folder") do
146
+ require_relative "cap/guest/freebsd/sshfs_forward_mount"
147
+ VagrantPlugins::GuestFreeBSD::Cap::MountSSHFS
148
+ end
149
+
150
+ guest_capability("freebsd", "sshfs_forward_is_folder_mounted") do
151
+ require_relative "cap/guest/freebsd/sshfs_forward_mount"
152
+ VagrantPlugins::GuestFreeBSD::Cap::MountSSHFS
153
+ end
154
+
155
+ guest_capability("freebsd", "sshfs_get_absolute_path") do
156
+ require_relative "cap/guest/linux/sshfs_get_absolute_path"
157
+ VagrantPlugins::GuestLinux::Cap::SSHFSGetAbsolutePath
158
+ end
159
+
160
+ guest_capability("freebsd", "sshfs_install") do
161
+ require_relative "cap/guest/freebsd/sshfs_client"
162
+ VagrantPlugins::GuestFreeBSD::Cap::SSHFSClient
163
+ end
164
+
165
+ guest_capability("freebsd", "sshfs_installed") do
166
+ require_relative "cap/guest/freebsd/sshfs_client"
167
+ VagrantPlugins::GuestFreeBSD::Cap::SSHFSClient
168
+ end
123
169
  end
124
170
  end
125
171
  end
@@ -113,6 +113,7 @@ module VagrantPlugins
113
113
  ENV['PATH'] += ':/usr/libexec/openssh' # Linux (Red Hat Family)
114
114
  ENV['PATH'] += ':/usr/lib/openssh' # Linux (Debian Family)
115
115
  ENV['PATH'] += ':/usr/lib/ssh' # Linux (Arch Linux Family)
116
+ ENV['PATH'] += ':/usr/lib/misc' # Linux (Gentoo Family)
116
117
  ENV['PATH'] += ':/usr/libexec/' # Mac OS X
117
118
  end
118
119
 
@@ -101,7 +101,7 @@ module VagrantPlugins
101
101
  if not opts.has_key?(:ssh_password) or not opts[:ssh_password]
102
102
  if not ssh_info.has_key?(:forward_agent) or not ssh_info[:forward_agent]
103
103
  prompt_for_password = true
104
- end
104
+ end
105
105
  end
106
106
 
107
107
  # Now do the prompt
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module SyncedFolderSSHFS
3
- VERSION = "1.3.0"
3
+ VERSION = "1.3.1"
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ Vagrant.configure(2) do |config|
12
12
  end
13
13
 
14
14
  host = 'viv-libvirt' # vagrant in vagrant - to test libvirt
15
- box = 'fedora/24-cloud-base'
15
+ box = 'fedora/25-cloud-base'
16
16
 
17
17
  config.vm.define host do | tmp |
18
18
  tmp.vm.hostname = host
@@ -10,7 +10,7 @@ Vagrant.configure(2) do |config|
10
10
  # https://github.com/dustymabe/vagrant-sshfs/issues/44
11
11
  config.vm.synced_folder "/etc/", "/sbin/forward_slave_mount_sym_link_test/", type: "sshfs"
12
12
 
13
- # Test a forward normal mount:
13
+ # Test a forward normal mount:
14
14
  # mounting a folder from a 3rd party host into guest
15
15
  config.vm.synced_folder "/etc/", "/tmp/forward_normal_mount_etc/", type: "sshfs",
16
16
  ssh_host: ENV['THIRD_PARTY_HOST'],
@@ -22,7 +22,7 @@ Vagrant.configure(2) do |config|
22
22
  config.vm.synced_folder "/tmp/reverse_mount_etc/", "/etc", type: "sshfs", reverse: true
23
23
 
24
24
  host = 'vagrant-sshfs-tests'
25
- box = 'fedora/24-cloud-base'
25
+ box = 'fedora/25-cloud-base'
26
26
 
27
27
  config.vm.define host do | tmp |
28
28
  tmp.vm.hostname = host
@@ -16,7 +16,7 @@ Vagrant.configure(2) do |config|
16
16
  end
17
17
 
18
18
  host = 'viv-virtbox' # vagrant in vagrant - to test virtbox
19
- box = 'fedora/24-cloud-base'
19
+ box = 'fedora/25-cloud-base'
20
20
 
21
21
  config.vm.define host do | tmp |
22
22
  tmp.vm.hostname = host
@@ -23,9 +23,9 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_dependency 'win32-process'
25
25
 
26
- spec.add_development_dependency 'bundler', '~> 1.7'
27
- spec.add_development_dependency 'rake', '~> 10.0'
28
- spec.add_development_dependency 'cucumber', '~> 2.1'
29
- spec.add_development_dependency 'aruba', '~> 0.13'
30
- spec.add_development_dependency 'komenda', '~> 0.1.6'
26
+ spec.add_development_dependency 'bundler'
27
+ spec.add_development_dependency 'rake'
28
+ spec.add_development_dependency 'cucumber'
29
+ spec.add_development_dependency 'aruba'
30
+ spec.add_development_dependency 'komenda'
31
31
  end
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.3.0
4
+ version: 1.3.1
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-26 00:00:00.000000000 Z
11
+ date: 2018-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: win32-process
@@ -28,72 +28,72 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.7'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.7'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: cucumber
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '2.1'
61
+ version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '2.1'
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aruba
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0.13'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0.13'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: komenda
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 0.1.6
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 0.1.6
96
+ version: '0'
97
97
  description: "\n A Vagrant synced folder plugin that mounts folders via SSHFS.
98
98
  \n This is the successor to Fabio Kreusch's implementation:\n https://github.com/fabiokr/vagrant-sshfs"
99
99
  email:
@@ -113,9 +113,12 @@ files:
113
113
  - features/step_definitions/sshfs_cwd_mount_steps.rb
114
114
  - features/support/env.rb
115
115
  - lib/vagrant-sshfs.rb
116
+ - lib/vagrant-sshfs/action_hostpath_fixup.rb
116
117
  - lib/vagrant-sshfs/cap/guest/arch/sshfs_client.rb
117
118
  - lib/vagrant-sshfs/cap/guest/debian/sshfs_client.rb
118
119
  - lib/vagrant-sshfs/cap/guest/fedora/sshfs_client.rb
120
+ - lib/vagrant-sshfs/cap/guest/freebsd/sshfs_client.rb
121
+ - lib/vagrant-sshfs/cap/guest/freebsd/sshfs_forward_mount.rb
119
122
  - lib/vagrant-sshfs/cap/guest/linux/sshfs_client.rb
120
123
  - lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
121
124
  - lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
@@ -159,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
162
  version: '0'
160
163
  requirements: []
161
164
  rubyforge_project:
162
- rubygems_version: 2.5.1
165
+ rubygems_version: 2.6.14.1
163
166
  signing_key:
164
167
  specification_version: 4
165
168
  summary: 'A Vagrant synced folder plugin that mounts folders via SSHFS. This is the