vagrant-sshfs 1.1.0 → 1.2.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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -1
  4. data/README.md +82 -21
  5. data/Rakefile +37 -1
  6. data/features/README.md +21 -0
  7. data/features/sshfs_cwd_mount.feature +46 -0
  8. data/features/step_definitions/sshfs_cwd_mount_steps.rb +12 -0
  9. data/features/support/env.rb +27 -0
  10. data/lib/vagrant-sshfs/cap/{arch → guest/arch}/sshfs_client.rb +0 -0
  11. data/lib/vagrant-sshfs/cap/{debian → guest/debian}/sshfs_client.rb +0 -0
  12. data/lib/vagrant-sshfs/cap/{fedora → guest/fedora}/sshfs_client.rb +0 -0
  13. data/lib/vagrant-sshfs/cap/{linux → guest/linux}/sshfs_client.rb +0 -0
  14. data/lib/vagrant-sshfs/cap/{linux/sshfs_mount.rb → guest/linux/sshfs_forward_mount.rb} +124 -14
  15. data/lib/vagrant-sshfs/cap/{redhat → guest/redhat}/sshfs_client.rb +0 -0
  16. data/lib/vagrant-sshfs/cap/{suse → guest/suse}/sshfs_client.rb +0 -0
  17. data/lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb +176 -0
  18. data/lib/vagrant-sshfs/command.rb +16 -4
  19. data/lib/vagrant-sshfs/errors.rb +8 -0
  20. data/lib/vagrant-sshfs/plugin.rb +35 -15
  21. data/lib/vagrant-sshfs/synced_folder/sshfs_forward_mount.rb +116 -0
  22. data/lib/vagrant-sshfs/synced_folder/sshfs_reverse_mount.rb +51 -0
  23. data/lib/vagrant-sshfs/synced_folder.rb +43 -83
  24. data/lib/vagrant-sshfs/version.rb +1 -1
  25. data/lib/vagrant-sshfs.rb +8 -0
  26. data/locales/synced_folder_sshfs.yml +42 -5
  27. data/test/libvirt/README.txt +15 -0
  28. data/test/libvirt/Vagrantfile +35 -0
  29. data/test/misc/README.txt +29 -0
  30. data/test/misc/Vagrantfile +27 -0
  31. data/test/misc/dotests.sh +13 -0
  32. data/test/virtualbox/README.txt +17 -0
  33. data/test/virtualbox/Vagrantfile +42 -0
  34. data/vagrant-sshfs.gemspec +7 -2
  35. metadata +93 -11
data/lib/vagrant-sshfs.rb CHANGED
@@ -4,6 +4,14 @@ 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
9
+ # time by Vagrant. The Process.create() function actually gets used in
10
+ # lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
11
+ if Vagrant::Util::Platform.windows?
12
+ require 'win32/process'
13
+ end
14
+
7
15
  require "vagrant-sshfs/errors"
8
16
  require "vagrant-sshfs/version"
9
17
  require "vagrant-sshfs/plugin"
@@ -3,7 +3,14 @@ en:
3
3
  sshfs:
4
4
  actions:
5
5
  installing: Installing SSHFS client...
6
- mounting: Mounting SSHFS shared folders...
6
+ mounting: Mounting SSHFS shared folder...
7
+ unmounting: Unmounting SSHFS shared folder...
8
+ unmounting_folder: |-
9
+ Unmounting SSHFS shared folder mounted at %{guestpath}
10
+ reverse_unmounting_folder: |-
11
+ Unmounting SSHFS shared folder mounted at host's %{hostpath}
12
+ reverse_mounting_folder: |-
13
+ mounting folder via SSHFS: guestpath:%{guestpath} => hostpath:%{hostpath}
7
14
  slave_mounting_folder: |-
8
15
  Mounting folder via SSHFS: %{hostpath} => %{guestpath}
9
16
  normal_mounting_folder: |-
@@ -15,7 +22,9 @@ en:
15
22
  detected_host_ip: |-
16
23
  Detected host IP address is '%{ip}'
17
24
  already_mounted: |-
18
- The folder %{folder} in the guest already mounted.
25
+ The folder %{folder} in the %{location} is already mounted.
26
+ not_mounted: |-
27
+ The folder %{folder} in the %{location} is not mounted.
19
28
  errors:
20
29
  communicator_not_ready: |-
21
30
  The machine is reporting that it is not ready to communicate via ssh. Verify
@@ -50,7 +59,35 @@ en:
50
59
  Stderr from the command:
51
60
 
52
61
  %{stderr}
62
+ reverse_mount_failed: |-
63
+ Mounting SSHFS shared folder via reverse SSHFS mount failed. Please
64
+ look at the below output from from the processes that were run.
65
+
66
+ SSHFS command output:
67
+
68
+ %{sshfs_output}
53
69
  slave_mount_failed: |-
54
- Mounting SSHFS shared via slave SSHFS mount failed. Please look at your
55
- terminal scrollback to look for any error messages from the processes that
56
- were run.
70
+ Mounting SSHFS shared folder via slave SSHFS mount failed. Please
71
+ look at the below STDERR output from the processes that were run.
72
+
73
+ SSH command:
74
+
75
+ %{ssh_stderr}
76
+
77
+ SFTP command:
78
+
79
+ %{sftp_stderr}
80
+ unmount_failed: |-
81
+ Unmount the SSHFS mount failed.
82
+
83
+ The command and output are:
84
+
85
+ %{command}
86
+
87
+ Stdout from the command:
88
+
89
+ %{stdout}
90
+
91
+ Stderr from the command:
92
+
93
+ %{stderr}
@@ -0,0 +1,15 @@
1
+
2
+ To bring up vagrant host:
3
+
4
+ vagrant up
5
+
6
+ To run tests:
7
+
8
+ vagrant ssh
9
+
10
+ and then:
11
+
12
+ cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/
13
+ gem install bundler
14
+ bundle install
15
+ bundle exec rake featuretests
@@ -0,0 +1,35 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+ Vagrant.configure(2) do |config|
4
+
5
+ config.ssh.insert_key = 'true'
6
+ config.vm.synced_folder "/guests/sharedfolder", "/sharedfolder", type: "sshfs"
7
+
8
+ config.vm.provider :libvirt do |domain|
9
+ domain.memory = 4096
10
+ domain.cpus = 4
11
+ domain.nested = true
12
+ end
13
+
14
+ host = 'viv-libvirt' # vagrant in vagrant - to test libvirt
15
+ box = 'fedora/24-cloud-base'
16
+
17
+ config.vm.define host do | tmp |
18
+ tmp.vm.hostname = host
19
+ tmp.vm.box = box
20
+ end
21
+ config.vm.provision "shell", inline: <<-SHELL
22
+ rpms=(
23
+ libvirt-daemon-kvm # for vagrant libvirt support
24
+ make gcc ruby ruby-devel redhat-rpm-config # for building gems
25
+ gcc-c++ # for building unf_ext
26
+ libvirt-devel # for building ruby-libvirt gem
27
+ zlib-devel # for building nokogiri gem
28
+ git # for the git ls-files in gemspec file
29
+ bsdtar # used by vagrant to unpack box files
30
+ )
31
+ dnf install -y ${rpms[@]}
32
+ usermod -a -G libvirt vagrant
33
+ systemctl start libvirtd virtlogd
34
+ SHELL
35
+ end
@@ -0,0 +1,29 @@
1
+
2
+ # This directory is for testing the three different mount modes
3
+ # that are supported by vagrant-sshfs
4
+
5
+ # To test we will first create the directory on the machien where
6
+ # we will mount the guest /etc/ into the host (the reverse mount).
7
+
8
+ mkdir /tmp/reverse_mount_etc
9
+
10
+ # Next we will define where our 3rd party host is (the normal mount).
11
+ # This can be another vagrant box or whatever machine you want.
12
+ export THIRD_PARTY_HOST='192.168.121.73'
13
+ export THIRD_PARTY_HOST_USER='vagrant'
14
+ export THIRD_PARTY_HOST_PASS='vagrant'
15
+
16
+ # Next vagrant up - will do 3 mounts (normal, slave, reverse).
17
+ vagrant up
18
+
19
+ # Next run the script to test the mounts:
20
+ $ bash dotests.sh
21
+ Testing normal mount!
22
+ a57e39fa692f294e860349a9451be67c
23
+ Testing slave mount!
24
+ e2c4ceac71dc414cb3ed864cff04a917
25
+ Testing reverse mount!
26
+ 508619e7e68e446c84d1fcdf7e0dc577
27
+
28
+ # We are printing out the machine-id under each mount to prove each
29
+ # mount is from a different machine.
@@ -0,0 +1,27 @@
1
+ Vagrant.configure(2) do |config|
2
+
3
+ config.ssh.insert_key = 'true'
4
+
5
+ # Test a forward normal mount:
6
+ # mounting a folder from a 3rd party host into guest
7
+ config.vm.synced_folder "/etc/", "/tmp/forward_normal_mount_etc/", type: "sshfs",
8
+ ssh_host: ENV['THIRD_PARTY_HOST'],
9
+ ssh_username: ENV['THIRD_PARTY_HOST_USER'],
10
+ ssh_password: ENV['THIRD_PARTY_HOST_PASS']
11
+
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
+ # Test a reverse mount:
17
+ # mounting /etc/ from vagrant guest into vagrant host
18
+ config.vm.synced_folder "/tmp/reverse_mount_etc/", "/etc", type: "sshfs", reverse: true
19
+
20
+ host = 'vagrant-sshfs-tests'
21
+ box = 'fedora/24-cloud-base'
22
+
23
+ config.vm.define host do | tmp |
24
+ tmp.vm.hostname = host
25
+ tmp.vm.box = box
26
+ end
27
+ end
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+ set -eu
3
+
4
+ # Test the three mounts we have done
5
+
6
+ echo "Testing normal mount!"
7
+ vagrant ssh -- cat /tmp/forward_normal_mount_etc/machine-id
8
+
9
+ echo "Testing slave mount!"
10
+ vagrant ssh -- cat /tmp/forward_slave_mount_etc/machine-id
11
+
12
+ echo "Testing reverse mount!"
13
+ cat /tmp/reverse_mount_etc/machine-id
@@ -0,0 +1,17 @@
1
+ # XXX Note this is not working right now as nested virt. I keep
2
+ # getting kernel tracebacks on Fedora 24.
3
+
4
+ To bring up vagrant host:
5
+
6
+ vagrant up
7
+
8
+ To run tests:
9
+
10
+ vagrant ssh
11
+
12
+ and then:
13
+
14
+ cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/
15
+ gem install bundler
16
+ bundle install
17
+ bundle exec rake featuretests
@@ -0,0 +1,42 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+ #
4
+ # XXX Note this is not working right now as nested virt. I keep
5
+ # getting kernel tracebacks on Fedora 24.
6
+ #
7
+ Vagrant.configure(2) do |config|
8
+
9
+ config.ssh.insert_key = 'true'
10
+ config.vm.synced_folder "/guests/sharedfolder", "/sharedfolder", type: "sshfs"
11
+
12
+ config.vm.provider :libvirt do |domain|
13
+ domain.memory = 4096
14
+ domain.cpus = 4
15
+ domain.nested = true
16
+ end
17
+
18
+ host = 'viv-virtbox' # vagrant in vagrant - to test virtbox
19
+ box = 'fedora/24-cloud-base'
20
+
21
+ config.vm.define host do | tmp |
22
+ tmp.vm.hostname = host
23
+ tmp.vm.box = box
24
+ end
25
+ # Must use VirtualBox-5.0 - 5.1 not supported by Vagrant yet
26
+ config.vm.provision "shell", inline: <<-SHELL
27
+ dnf config-manager --add-repo http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
28
+ rpms=(
29
+ kernel-devel-$(uname -r) kernel-headers-$(uname -r)
30
+ gcc make VirtualBox-5.0 # all for virtualbox support
31
+ make gcc ruby ruby-devel redhat-rpm-config # for building gems
32
+ gcc-c++ # for building unf_ext
33
+ libvirt-devel # for building ruby-libvirt gem
34
+ zlib-devel # for building nokogiri gem
35
+ git # for the git ls-files in gemspec file
36
+ bsdtar # used by vagrant to unpack box files
37
+ )
38
+ dnf install -y ${rpms[@]}
39
+ /usr/lib/virtualbox/vboxdrv.sh setup
40
+ usermod -a -G vboxusers vagrant
41
+ SHELL
42
+ end
@@ -21,6 +21,11 @@ Gem::Specification.new do |spec|
21
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.7"
25
- spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_dependency 'win32-process'
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
31
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-sshfs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.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-03-30 00:00:00.000000000 Z
11
+ date: 2016-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: win32-process
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +52,48 @@ dependencies:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
54
  version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: cucumber
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: aruba
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.13'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: komenda
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.1.6
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.1.6
41
97
  description: "\n A Vagrant synced folder plugin that mounts folders via SSHFS.
42
98
  \n This is the successor to Fabio Kreusch's implementation:\n https://github.com/fabiokr/vagrant-sshfs"
43
99
  email:
@@ -46,24 +102,39 @@ executables: []
46
102
  extensions: []
47
103
  extra_rdoc_files: []
48
104
  files:
105
+ - ".gitignore"
49
106
  - Gemfile
50
107
  - LICENSE
51
108
  - README.md
52
109
  - Rakefile
110
+ - features/README.md
111
+ - features/sshfs_cwd_mount.feature
112
+ - features/step_definitions/sshfs_cwd_mount_steps.rb
113
+ - features/support/env.rb
53
114
  - lib/vagrant-sshfs.rb
54
- - lib/vagrant-sshfs/cap/arch/sshfs_client.rb
55
- - lib/vagrant-sshfs/cap/debian/sshfs_client.rb
56
- - lib/vagrant-sshfs/cap/fedora/sshfs_client.rb
57
- - lib/vagrant-sshfs/cap/linux/sshfs_client.rb
58
- - lib/vagrant-sshfs/cap/linux/sshfs_mount.rb
59
- - lib/vagrant-sshfs/cap/redhat/sshfs_client.rb
60
- - lib/vagrant-sshfs/cap/suse/sshfs_client.rb
115
+ - lib/vagrant-sshfs/cap/guest/arch/sshfs_client.rb
116
+ - lib/vagrant-sshfs/cap/guest/debian/sshfs_client.rb
117
+ - lib/vagrant-sshfs/cap/guest/fedora/sshfs_client.rb
118
+ - lib/vagrant-sshfs/cap/guest/linux/sshfs_client.rb
119
+ - lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
120
+ - lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb
121
+ - lib/vagrant-sshfs/cap/guest/suse/sshfs_client.rb
122
+ - lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb
61
123
  - lib/vagrant-sshfs/command.rb
62
124
  - lib/vagrant-sshfs/errors.rb
63
125
  - lib/vagrant-sshfs/plugin.rb
64
126
  - lib/vagrant-sshfs/synced_folder.rb
127
+ - lib/vagrant-sshfs/synced_folder/sshfs_forward_mount.rb
128
+ - lib/vagrant-sshfs/synced_folder/sshfs_reverse_mount.rb
65
129
  - lib/vagrant-sshfs/version.rb
66
130
  - locales/synced_folder_sshfs.yml
131
+ - test/libvirt/README.txt
132
+ - test/libvirt/Vagrantfile
133
+ - test/misc/README.txt
134
+ - test/misc/Vagrantfile
135
+ - test/misc/dotests.sh
136
+ - test/virtualbox/README.txt
137
+ - test/virtualbox/Vagrantfile
67
138
  - vagrant-sshfs.gemspec
68
139
  homepage: https://github.com/dustymabe/vagrant-sshfs
69
140
  licenses:
@@ -85,9 +156,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
156
  version: '0'
86
157
  requirements: []
87
158
  rubyforge_project:
88
- rubygems_version: 2.4.8
159
+ rubygems_version: 2.5.1
89
160
  signing_key:
90
161
  specification_version: 4
91
162
  summary: 'A Vagrant synced folder plugin that mounts folders via SSHFS. This is the
92
163
  successor to Fabio Kreusch''s implementation: https://github.com/fabiokr/vagrant-sshfs'
93
- test_files: []
164
+ test_files:
165
+ - features/README.md
166
+ - features/sshfs_cwd_mount.feature
167
+ - features/step_definitions/sshfs_cwd_mount_steps.rb
168
+ - features/support/env.rb
169
+ - test/libvirt/README.txt
170
+ - test/libvirt/Vagrantfile
171
+ - test/misc/README.txt
172
+ - test/misc/Vagrantfile
173
+ - test/misc/dotests.sh
174
+ - test/virtualbox/README.txt
175
+ - test/virtualbox/Vagrantfile