vagrant-sshfs 1.3.0 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +2 -3
  3. data/README.adoc +3 -6
  4. data/RELEASE.txt +34 -26
  5. data/Rakefile +0 -10
  6. data/build.sh +43 -0
  7. data/lib/vagrant-sshfs.rb +2 -2
  8. data/lib/vagrant-sshfs/action_hostpath_fixup.rb +130 -0
  9. data/lib/vagrant-sshfs/cap/guest/alpine/sshfs_client.rb +24 -0
  10. data/lib/vagrant-sshfs/cap/guest/centos/sshfs_client.rb +38 -0
  11. data/lib/vagrant-sshfs/cap/guest/debian/sshfs_client.rb +1 -0
  12. data/lib/vagrant-sshfs/cap/guest/freebsd/sshfs_client.rb +22 -0
  13. data/lib/vagrant-sshfs/cap/guest/freebsd/sshfs_forward_mount.rb +13 -0
  14. data/lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb +53 -30
  15. data/lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb +1 -1
  16. data/lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb +19 -8
  17. data/lib/vagrant-sshfs/cap/host/darwin/sshfs_reverse_mount.rb +13 -6
  18. data/lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb +13 -8
  19. data/lib/vagrant-sshfs/plugin.rb +66 -0
  20. data/lib/vagrant-sshfs/synced_folder.rb +1 -0
  21. data/lib/vagrant-sshfs/synced_folder/sshfs_forward_mount.rb +1 -1
  22. data/lib/vagrant-sshfs/version.rb +1 -1
  23. data/test/misc/README.txt +1 -1
  24. data/test/misc/Vagrantfile +4 -4
  25. data/test/misc/dotests.sh +1 -1
  26. data/vagrant-sshfs.gemspec +2 -5
  27. metadata +17 -70
  28. data/features/README.md +0 -21
  29. data/features/sshfs_cwd_mount.feature +0 -46
  30. data/features/step_definitions/sshfs_cwd_mount_steps.rb +0 -12
  31. data/features/support/env.rb +0 -27
  32. data/test/libvirt/README.txt +0 -23
  33. data/test/libvirt/Vagrantfile +0 -35
  34. data/test/virtualbox/README.txt +0 -25
  35. data/test/virtualbox/Vagrantfile +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e143084a7768bace31ec459ae109ee5ccf28c7d2
4
- data.tar.gz: 3e24221afc2606cbee0bde74375533a5f4e9e753
2
+ SHA256:
3
+ metadata.gz: 6513280765fd1bba7182361d9f45354f46bf094d4880da5aa53f37f25fdaab3b
4
+ data.tar.gz: 8eda8064052fca6390542acf1ce1a63aa98e04f4c69e8c9a66ff197cc868efcc
5
5
  SHA512:
6
- metadata.gz: 41a384e958c32f8dff2d5382ae2e98ceced18af213967f3709d8310fc103ea08b00394a5c5e20ed83cb7399739caca4d5227e8ec199fa6ab2f4daf5949cfbb46
7
- data.tar.gz: 313b0fa48db0015bb8862918975a5d090af0e42324ce93aff202d1cd5a840b759f5e331f74ad24495e5a6f2ab3ebc2cf569d3dfd0ed1995e173f5ce89b2eb993
6
+ metadata.gz: b7541dfccd42e153b37da97bc8d84427ca0c87674b0d2333861d98fb946b4ca3847d9c51ac0bb511525207554b21c075a9e22bba3fd6699f03737d877abad24d
7
+ data.tar.gz: 2e494e523004ded8fcd6644bcdf951728a534110df6d898a2fd55350f7df64842ac089483783c2433d76c4478e30e9185fbde16fff7280a09675749f47da4385
data/Gemfile CHANGED
@@ -6,12 +6,11 @@ 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.2.9'
10
10
  end
11
11
 
12
12
  group :plugins do
13
- gem "vagrant-sshfs" , path: "."
14
13
  # Add vagrant-libvirt plugin here, otherwise you won't be able to
15
14
  # use libvirt as a provider when you execute `bundle exec vagrant up`
16
- gem "vagrant-libvirt" , '0.0.33'
15
+ gem "vagrant-libvirt" , '0.0.45'
17
16
  end
@@ -33,6 +33,9 @@ exists on Linux/Mac. On windows you only need to install
33
33
  https://cygwin.com/cgi-bin2/package-grep.cgi?grep=openssh&arch=x86_64[openssh]
34
34
  via https://cygwin.com/[cygwin] and you will get `sftp-server`.
35
35
 
36
+ Also, we recommend running vagrant from the cygwin provided terminal. There have
37
+ been issues with other shells leading to problems with mounts.
38
+
36
39
 
37
40
  [[history]]
38
41
  == History
@@ -290,12 +293,6 @@ test and install this plugin on your local machine:
290
293
  # Install development dependencies
291
294
  $ gem install bundler && bundle install
292
295
 
293
- # List available Rake tasks
294
- $ bundle exec rake -T
295
-
296
- # Run Cucumber tests
297
- $ bundle exec rake featuretests
298
-
299
296
  # Build the gem (gets generated in the 'pkg' directory
300
297
  $ bundle exec rake build
301
298
 
@@ -1,51 +1,59 @@
1
1
 
2
+ # point local system to git for vagrant-sshfs
3
+ - cd /usr/share/vagrant/gems/gems
4
+ - sudo mv vagrant-sshfs-1.3.3 vsshfs133
5
+ - sudo ln -s /var/b/shared/code/github.com/dustymabe/vagrant-sshfs ./vagrant-sshfs-1.3.3
2
6
 
3
- # Run viv tests
4
- cd /guests/sharedfolder/code/github.com/dustymabe/vagrant-sshfs/test/libvirt
5
- vagrant up
7
+ # Run misc tests
8
+ cd /var/b/shared/code/github.com/dustymabe/vagrant-sshfs/test/misc
6
9
  follow README for running tests
7
10
 
8
11
  # Make sure to bump version in lib/vagrant-sshfs/version.rb and commit
9
12
  # DO NOT TAG YET
10
13
 
14
+ # Craft a commit message for the tag.
15
+ LASTTAG='v1.3.1'
16
+ VERSION='1.3.2'
17
+ NEWTAG="v${VERSION}"
18
+ cat <<EOF > release-notes.txt
19
+ This is release ${NEWTAG} of the vagrant-sshfs plugin.
11
20
 
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
21
+ Thanks to the following contributors for patches during this release:
14
22
 
15
- -> In vim add thanks to contributors - grab info with
16
- git log --no-merges --pretty=format:"%h - %an - %s"
17
- and
18
- git log --no-merges --pretty=format:"%h - %ae - %s"
19
-
20
-
21
- -> In vim add commit log - grab with
22
- git log --no-merges --pretty=format:"%h %s"
23
-
24
- -> In vim add release message - see previous tag for example
23
+ $(git shortlog --no-merges --pretty=format:"%h %s" -e ${LASTTAG}..HEAD)
24
+ EOF
25
25
 
26
26
  # After crafting message then install git-evtag and sign
27
27
 
28
- git-evtag sign vX.X.X
28
+ git-evtag sign ${NEWTAG}
29
29
 
30
30
 
31
31
  close and type in password for signing
32
32
 
33
- verify with git-evtag verify v1.2.0
34
- verify with git verify-tag v1.2.0
33
+ verify with git-evtag verify ${NEWTAG}
34
+ verify with git verify-tag ${NEWTAG}
35
35
 
36
36
  git push
37
37
  git push --tags
38
38
 
39
- # Build with bundle exec rake build (inside viv VM)
40
- bundle exec rake build
39
+ # Build with build.sh script (uses buildah)
40
+ # We must run it in a buildah unshare session. Otherwise we get the error:
41
+ #
42
+ # ++ buildah mount fedora-working-container
43
+ # cannot mount using driver overlay in rootless mode. You need to run it in a `buildah unshare` session
44
+ buildah unshare ./build.sh
45
+
46
+ # Sign the output (This will create a .asc file)
47
+ gpg2 --armor --detach-sign ./vagrant-sshfs-${VERSION}.gem
48
+
49
+ # make tar.gz and zip files
50
+ git archive --format=tar.gz ${NEWTAG} > vagrant-sshfs-${VERSION}.tar.gz
51
+ gpg2 --armor --detach-sign vagrant-sshfs-${VERSION}.tar.gz
52
+ git archive --format=zip ${NEWTAG} > vagrant-sshfs-${VERSION}.zip
53
+ gpg2 --armor --detach-sign vagrant-sshfs-${VERSION}.zip
41
54
 
42
- # Sign the output
43
- gpg --armor --detach-sign pkg/vagrant-sshfs-1.2.0.gem
44
- $ ls pkg/vagrant-sshfs-1.2.0.gem*
45
- pkg/vagrant-sshfs-1.2.0.gem pkg/vagrant-sshfs-1.2.0.gem.asc
46
55
 
47
56
  # Update release notes and upload files on github
48
57
 
49
58
  # push to rubygems with:
50
- gem push pkg/vagrant-sshfs-1.2.0.gem
51
-
59
+ gem push ./vagrant-sshfs-${VERSION}.gem
data/Rakefile CHANGED
@@ -7,9 +7,6 @@
7
7
  #
8
8
  require 'bundler/gem_tasks'
9
9
 
10
- # cucumber/rake/task provides us with an easy way to call cucumber
11
- require 'cucumber/rake/task'
12
-
13
10
  # rake/clean provides CLEAN/CLOBBER
14
11
  # http://www.virtuouscode.com/2014/04/28/rake-part-6-clean-and-clobber/
15
12
  # CLEAN - list to let rake know what files can be cleaned up after build
@@ -29,10 +26,3 @@ CLOBBER.include('pkg')
29
26
  task :init do
30
27
  FileUtils.mkdir_p 'build'
31
28
  end
32
-
33
- # Create new Cucumber::Rake::Task that will run Cucumber tests
34
- Cucumber::Rake::Task.new(:featuretests)
35
-
36
- # Define Rake::Task dependency - run :init before :featuretests
37
- task :featuretests => :init
38
-
@@ -0,0 +1,43 @@
1
+ #!/bin/bash -x
2
+ set -ex
3
+
4
+ ctr=$(buildah from registry.fedoraproject.org/fedora:31)
5
+
6
+ rpms=(
7
+ make gcc ruby ruby-devel redhat-rpm-config # for building gems
8
+ gcc-c++ # for building unf_ext
9
+ libvirt-devel # for building ruby-libvirt gem
10
+ zlib-devel # for building nokogiri gem
11
+ git # for the git ls-files in gemspec file
12
+ bsdtar # used by vagrant to unpack box files
13
+ )
14
+
15
+ WORKINGDIR='/tmp/workingdir/'
16
+
17
+ # Set working directory
18
+ buildah config --workingdir $WORKINGDIR $ctr
19
+
20
+ # Get all updates and install needed rpms
21
+ buildah run $ctr -- dnf update -y
22
+ buildah run $ctr -- dnf install -y ${rpms[@]}
23
+
24
+ # Add source code
25
+ buildah add $ctr './' $WORKINGDIR
26
+
27
+ # Install bundler
28
+ buildah run $ctr -- gem install bundler
29
+
30
+ # Install all needed gems
31
+ buildah run $ctr -- bundle install --with plugins
32
+
33
+ # Install all needed gems
34
+ buildah run $ctr -- bundle exec rake build
35
+
36
+ # Copy built files outside of container
37
+ mount=$(buildah mount $ctr)
38
+ package=$(ls $mount/$WORKINGDIR/pkg/vagrant-sshfs-*gem)
39
+ echo "copying to ./$(basename $package)"
40
+ cp $package ./
41
+ buildah umount $ctr
42
+
43
+ echo "Built package is at ./$(basename $package)"
@@ -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
@@ -0,0 +1,24 @@
1
+ module VagrantPlugins
2
+ module GuestAlpine
3
+ module Cap
4
+ class SSHFSClient
5
+ def self.sshfs_install(machine)
6
+ # Install sshfs
7
+ machine.communicate.sudo("apk add sshfs")
8
+ # Load the fuse module
9
+ machine.communicate.sudo("modprobe fuse")
10
+ end
11
+
12
+ def self.sshfs_installed(machine)
13
+ installed = machine.communicate.test("apk -e info sshfs")
14
+ if installed
15
+ # fuse may not get loaded at boot, so check if it's loaded otherwise force load it
16
+ machine.communicate.sudo("lsmod | grep fuse || modprobe fuse")
17
+ end
18
+
19
+ installed
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,38 @@
1
+ module VagrantPlugins
2
+ module GuestCentOS
3
+ module Cap
4
+ class SSHFSClient
5
+ def self.sshfs_install(machine)
6
+
7
+ case machine.guest.capability("flavor")
8
+ when :centos_8
9
+ # No need to install epel. fuse-sshfs comes from the PowerTools repo
10
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1758884
11
+ machine.communicate.sudo("yum -y install --enablerepo=PowerTools fuse-sshfs")
12
+ when :centos_7, :centos # centos7 and centos6
13
+ # Install fuse-sshfs from epel
14
+ if !epel_installed(machine)
15
+ epel_install(machine)
16
+ end
17
+ machine.communicate.sudo("yum -y install fuse-sshfs")
18
+ end
19
+ end
20
+
21
+ def self.sshfs_installed(machine)
22
+ machine.communicate.test("rpm -q fuse-sshfs")
23
+ end
24
+
25
+ protected
26
+
27
+ def self.epel_installed(machine)
28
+ machine.communicate.test("rpm -q epel-release")
29
+ end
30
+
31
+ def self.epel_install(machine)
32
+ machine.communicate.sudo("yum -y install epel-release")
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ 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