vagrant-sshfs 1.3.6 → 1.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/build.sh +1 -1
- data/lib/vagrant-sshfs/cap/guest/alma/sshfs_client.rb +39 -0
- data/lib/vagrant-sshfs/cap/guest/centos/sshfs_client.rb +14 -1
- data/lib/vagrant-sshfs/cap/guest/freebsd/sshfs_client.rb +11 -3
- data/lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb +21 -1
- data/lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb +10 -2
- data/lib/vagrant-sshfs/cap/guest/rocky/sshfs_client.rb +39 -0
- data/lib/vagrant-sshfs/cap/host/darwin/sshfs_reverse_mount.rb +33 -2
- data/lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb +33 -0
- data/lib/vagrant-sshfs/plugin.rb +20 -0
- data/lib/vagrant-sshfs/version.rb +1 -1
- data/test/misc/README.txt +21 -15
- data/test/misc/Vagrantfile +27 -8
- data/test/misc/dotests.sh +9 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72b97abe094123820d790b417d595675003b24a8a0ba4adbfc943aa8663076f7
|
4
|
+
data.tar.gz: 63fd927bcd56ce74257edff5588d8025057a2746f859c81f1e4c8a311fd635da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e810e679a39964500567be12233816f504301b7e0aa4f222b6ac2c1dfbbc2e5b314fc1b40015a70532eae759d978f5820992b448e944be51467ccb328671282
|
7
|
+
data.tar.gz: 7c0451482703f81bb0a8a740a4a094b51b7d7529d73e302bdf7312e44e1d84e2cf6c002b40858696a84c67b12c4e01f6a935e0e0c482c035d9ee226751e99c2f
|
data/Gemfile
CHANGED
@@ -6,11 +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 => 'v2.2.
|
9
|
+
gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git", :ref => 'v2.2.19'
|
10
10
|
end
|
11
11
|
|
12
12
|
group :plugins do
|
13
13
|
# Add vagrant-libvirt plugin here, otherwise you won't be able to
|
14
14
|
# use libvirt as a provider when you execute `bundle exec vagrant up`
|
15
|
-
gem "vagrant-libvirt" , '0.
|
15
|
+
gem "vagrant-libvirt" , '0.7.0'
|
16
16
|
end
|
data/build.sh
CHANGED
@@ -0,0 +1,39 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestAlma
|
3
|
+
module Cap
|
4
|
+
class SSHFSClient
|
5
|
+
def self.sshfs_install(machine)
|
6
|
+
|
7
|
+
case machine.guest.capability("flavor")
|
8
|
+
when :alma_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
|
+
# https://github.com/dustymabe/vagrant-sshfs/issues/123
|
12
|
+
machine.communicate.sudo("yum -y install --enablerepo=powertools fuse-sshfs")
|
13
|
+
when :alma_9, :alma # alma9 or unknown
|
14
|
+
# Install fuse-sshfs from epel
|
15
|
+
if !epel_installed(machine)
|
16
|
+
epel_install(machine)
|
17
|
+
end
|
18
|
+
machine.communicate.sudo("yum -y install fuse-sshfs")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.sshfs_installed(machine)
|
23
|
+
machine.communicate.test("rpm -q fuse-sshfs")
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def self.epel_installed(machine)
|
29
|
+
machine.communicate.test("rpm -q epel-release")
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.epel_install(machine)
|
33
|
+
machine.communicate.sudo("yum -y install epel-release")
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -4,13 +4,26 @@ module VagrantPlugins
|
|
4
4
|
class SSHFSClient
|
5
5
|
def self.sshfs_install(machine)
|
6
6
|
|
7
|
+
# Until a newer version of Vagrant ships with https://github.com/hashicorp/vagrant/pull/12785
|
8
|
+
# we need to handle the case where Alma or Rocky end up here
|
9
|
+
if machine.communicate.test("grep 'VERSION_ID=\"8' /etc/os-release")
|
10
|
+
machine.communicate.sudo("yum -y install --enablerepo=powertools fuse-sshfs")
|
11
|
+
return
|
12
|
+
elsif machine.communicate.test("grep 'VERSION_ID=\"9' /etc/os-release")
|
13
|
+
if !epel_installed(machine)
|
14
|
+
epel_install(machine)
|
15
|
+
end
|
16
|
+
machine.communicate.sudo("yum -y install fuse-sshfs")
|
17
|
+
return
|
18
|
+
end
|
19
|
+
|
7
20
|
case machine.guest.capability("flavor")
|
8
21
|
when :centos_8
|
9
22
|
# No need to install epel. fuse-sshfs comes from the powertools repo
|
10
23
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1758884
|
11
24
|
# https://github.com/dustymabe/vagrant-sshfs/issues/123
|
12
25
|
machine.communicate.sudo("yum -y install --enablerepo=powertools fuse-sshfs")
|
13
|
-
when :centos_7, :centos #
|
26
|
+
when :centos_9, :centos_7, :centos # centos{9,7,6}
|
14
27
|
# Install fuse-sshfs from epel
|
15
28
|
if !epel_installed(machine)
|
16
29
|
epel_install(machine)
|
@@ -4,14 +4,22 @@ module VagrantPlugins
|
|
4
4
|
class SSHFSClient
|
5
5
|
def self.sshfs_install(machine)
|
6
6
|
machine.communicate.sudo("pkg install -y fusefs-sshfs")
|
7
|
-
|
7
|
+
# older FreeBSD used fuse, newer uses fusefs
|
8
|
+
# https://github.com/dustymabe/vagrant-sshfs/issues/124
|
9
|
+
machine.communicate.sudo("kldload fuse || kldload fusefs")
|
8
10
|
end
|
9
11
|
|
10
12
|
def self.sshfs_installed(machine)
|
11
13
|
installed = machine.communicate.test("pkg info fusefs-sshfs")
|
12
14
|
if installed
|
13
|
-
# fuse may not get loaded at boot, so check if it's loaded
|
14
|
-
|
15
|
+
# fuse may not get loaded at boot, so check if it's loaded
|
16
|
+
# If not loaded then force load it
|
17
|
+
loaded = machine.communicate.test("kldstat -m fuse || kldstat -m fusefs")
|
18
|
+
if not loaded
|
19
|
+
# older FreeBSD used fuse, newer uses fusefs
|
20
|
+
# https://github.com/dustymabe/vagrant-sshfs/issues/124
|
21
|
+
machine.communicate.sudo("kldload fuse || kldload fusefs")
|
22
|
+
end
|
15
23
|
end
|
16
24
|
|
17
25
|
installed
|
@@ -2,6 +2,7 @@ require "log4r"
|
|
2
2
|
require "vagrant/util/retryable"
|
3
3
|
require "vagrant/util/platform"
|
4
4
|
require "tempfile"
|
5
|
+
require Vagrant.source_root.join("plugins/synced_folders/unix_mount_helpers")
|
5
6
|
|
6
7
|
# This is already done for us in lib/vagrant-sshfs.rb. We needed to
|
7
8
|
# do it there before Process.uid is called the first time by Vagrant
|
@@ -15,6 +16,7 @@ module VagrantPlugins
|
|
15
16
|
module Cap
|
16
17
|
class MountSSHFS
|
17
18
|
extend Vagrant::Util::Retryable
|
19
|
+
extend VagrantPlugins::SyncedFolder::UnixMountHelpers
|
18
20
|
@@logger = Log4r::Logger.new("vagrant::synced_folders::sshfs_mount")
|
19
21
|
|
20
22
|
def self.list_mounts_command
|
@@ -80,7 +82,25 @@ module VagrantPlugins
|
|
80
82
|
hostpath = File.expand_path(opts[:hostpath], machine.env.root_path)
|
81
83
|
hostpath = Vagrant::Util::Platform.fs_real_path(hostpath).to_s
|
82
84
|
end
|
83
|
-
|
85
|
+
|
86
|
+
# Support for user provided mount_options, owner, group
|
87
|
+
# https://github.com/hashicorp/vagrant/blob/2c3397c46851ef29a3589bf3214a3eee12da8484/website/content/docs/synced-folders/basic_usage.mdx#options
|
88
|
+
mount_options = opts.fetch(:mount_options, [])
|
89
|
+
# Determine owner/group info to use
|
90
|
+
if (opts.has_key?(:owner) and opts[:owner]) or
|
91
|
+
(opts.has_key?(:group) and opts[:group])
|
92
|
+
detected_ids = detect_owner_group_ids(
|
93
|
+
machine, expanded_guest_path, mount_options, opts)
|
94
|
+
mount_uid = detected_ids[:uid]
|
95
|
+
mount_gid = detected_ids[:gid]
|
96
|
+
mount_options.append("uid=#{mount_uid}")
|
97
|
+
mount_options.append("gid=#{mount_gid}")
|
98
|
+
end
|
99
|
+
# Combine mount_options into sshfs_opts_append (also user provided)
|
100
|
+
if not mount_options.empty?()
|
101
|
+
opts[:sshfs_opts_append] =
|
102
|
+
opts[:sshfs_opts_append].to_s + ' -o ' + mount_options.join(',') + ' '
|
103
|
+
end
|
84
104
|
|
85
105
|
# Add in some sshfs/fuse options that are common to both mount methods
|
86
106
|
opts[:sshfs_opts] = ' -o allow_other ' # allow non-root users to access
|
@@ -14,7 +14,7 @@ module VagrantPlugins
|
|
14
14
|
# on the system, which may have unintended consequences on RHEL8.
|
15
15
|
machine.communicate.sudo("rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7")
|
16
16
|
machine.communicate.sudo("yum -y install fuse-sshfs --repofrompath=epel7,'http://download.fedoraproject.org/pub/epel/7/$basearch'")
|
17
|
-
when :rhel_7, :rhel #
|
17
|
+
when :rhel_9, :rhel_7, :rhel # rhel{9,7,6}
|
18
18
|
# Install fuse-sshfs from epel
|
19
19
|
if !epel_installed(machine)
|
20
20
|
epel_install(machine)
|
@@ -35,10 +35,18 @@ module VagrantPlugins
|
|
35
35
|
|
36
36
|
def self.epel_install(machine)
|
37
37
|
case machine.guest.capability("flavor")
|
38
|
+
when :rhel_9
|
39
|
+
machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm")
|
38
40
|
when :rhel_7
|
39
41
|
machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm")
|
40
42
|
when :rhel # rhel6
|
41
|
-
|
43
|
+
# Until a newer version of Vagrant ships with https://github.com/hashicorp/vagrant/pull/12785
|
44
|
+
# we need to handle the case where Alma 9 and RHEL 9 end up here.
|
45
|
+
if machine.communicate.test("grep 'VERSION_ID=\"9' /etc/os-release")
|
46
|
+
machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm")
|
47
|
+
else
|
48
|
+
machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm")
|
49
|
+
end
|
42
50
|
end
|
43
51
|
end
|
44
52
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestRocky
|
3
|
+
module Cap
|
4
|
+
class SSHFSClient
|
5
|
+
def self.sshfs_install(machine)
|
6
|
+
|
7
|
+
case machine.guest.capability("flavor")
|
8
|
+
when :rocky_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
|
+
# https://github.com/dustymabe/vagrant-sshfs/issues/123
|
12
|
+
machine.communicate.sudo("yum -y install --enablerepo=powertools fuse-sshfs")
|
13
|
+
when :rocky_9, :rocky # rocky9 or unknown
|
14
|
+
# Install fuse-sshfs from epel
|
15
|
+
if !epel_installed(machine)
|
16
|
+
epel_install(machine)
|
17
|
+
end
|
18
|
+
machine.communicate.sudo("yum -y install fuse-sshfs")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.sshfs_installed(machine)
|
23
|
+
machine.communicate.test("rpm -q fuse-sshfs")
|
24
|
+
end
|
25
|
+
|
26
|
+
protected
|
27
|
+
|
28
|
+
def self.epel_installed(machine)
|
29
|
+
machine.communicate.test("rpm -q epel-release")
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.epel_install(machine)
|
33
|
+
machine.communicate.sudo("yum -y install epel-release")
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "etc"
|
1
2
|
require "log4r"
|
2
3
|
require "vagrant/util/retryable"
|
3
4
|
require "tempfile"
|
@@ -56,6 +57,12 @@ module VagrantPlugins
|
|
56
57
|
expanded_guest_path = machine.guest.capability(
|
57
58
|
:shell_expand_guest_path, opts[:guestpath])
|
58
59
|
|
60
|
+
# Create the mountpoint inside the guest
|
61
|
+
machine.communicate.tap do |comm|
|
62
|
+
comm.sudo("mkdir -p #{expanded_guest_path}")
|
63
|
+
comm.sudo("chmod 777 #{expanded_guest_path}")
|
64
|
+
end
|
65
|
+
|
59
66
|
# Mount path information
|
60
67
|
hostpath = opts[:hostpath].dup
|
61
68
|
hostpath.gsub!("'", "'\\\\''")
|
@@ -68,10 +75,8 @@ module VagrantPlugins
|
|
68
75
|
opts[:ssh_opts]+= ' -o ServerAliveInterval=30 ' # send keepalives
|
69
76
|
|
70
77
|
# SSH connection options
|
71
|
-
# Note the backslash escapes for IdentityFile - handles spaces in key path
|
72
78
|
ssh_opts = opts[:ssh_opts]
|
73
79
|
ssh_opts+= ' -o Port=' + machine.ssh_info[:port].to_s
|
74
|
-
ssh_opts+= ' -o "IdentityFile=\"' + machine.ssh_info[:private_key_path][0] + '\""'
|
75
80
|
ssh_opts+= ' -o UserKnownHostsFile=/dev/null '
|
76
81
|
ssh_opts+= ' -F /dev/null ' # Don't pick up options from user's config
|
77
82
|
if machine.ssh_info.key?(:private_key_path) and
|
@@ -84,9 +89,35 @@ module VagrantPlugins
|
|
84
89
|
|
85
90
|
ssh_opts_append = opts[:ssh_opts_append].to_s # provided by user
|
86
91
|
|
92
|
+
# Support for user provided mount_options, owner, group
|
93
|
+
# https://github.com/hashicorp/vagrant/blob/2c3397c46851ef29a3589bf3214a3eee12da8484/website/content/docs/synced-folders/basic_usage.mdx#options
|
94
|
+
mount_options = opts.fetch(:mount_options, [])
|
95
|
+
if (opts.has_key?(:owner) and opts[:owner]) or
|
96
|
+
(opts.has_key?(:group) and opts[:group])
|
97
|
+
# Identify the uid
|
98
|
+
if opts.has_key?(:owner) and opts[:owner]
|
99
|
+
mount_uid = Etc::getpwnam(opts[:owner]).uid
|
100
|
+
else
|
101
|
+
mount_uid = Etc::getpwnam(Etc.getlogin).uid
|
102
|
+
end
|
103
|
+
# Identify the gid. If a group was provided use that otherwise use
|
104
|
+
# the group detected with the detected user id.
|
105
|
+
if opts.has_key?(:group) and opts[:group]
|
106
|
+
mount_gid = Etc::getgrnam(opts[:group]).gid
|
107
|
+
else
|
108
|
+
mount_gid = Etc::getpwnam(Etc.getlogin).gid
|
109
|
+
end
|
110
|
+
# Add them to the mount options
|
111
|
+
mount_options.append("uid=#{mount_uid}")
|
112
|
+
mount_options.append("gid=#{mount_gid}")
|
113
|
+
end
|
114
|
+
|
87
115
|
# SSHFS executable options
|
88
116
|
sshfs_opts = opts[:sshfs_opts]
|
89
117
|
sshfs_opts_append = opts[:sshfs_opts_append].to_s # provided by user
|
118
|
+
if not mount_options.empty?()
|
119
|
+
sshfs_opts_append+= ' -o ' + mount_options.join(',') + ' '
|
120
|
+
end
|
90
121
|
|
91
122
|
username = machine.ssh_info[:username]
|
92
123
|
host = machine.ssh_info[:host]
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "etc"
|
1
2
|
require "log4r"
|
2
3
|
require "vagrant/util/retryable"
|
3
4
|
require "tempfile"
|
@@ -55,6 +56,12 @@ module VagrantPlugins
|
|
55
56
|
expanded_guest_path = machine.guest.capability(
|
56
57
|
:shell_expand_guest_path, opts[:guestpath])
|
57
58
|
|
59
|
+
# Create the mountpoint inside the guest
|
60
|
+
machine.communicate.tap do |comm|
|
61
|
+
comm.sudo("mkdir -p #{expanded_guest_path}")
|
62
|
+
comm.sudo("chmod 777 #{expanded_guest_path}")
|
63
|
+
end
|
64
|
+
|
58
65
|
# Mount path information
|
59
66
|
hostpath = opts[:hostpath].dup
|
60
67
|
hostpath.gsub!("'", "'\\\\''")
|
@@ -81,9 +88,35 @@ module VagrantPlugins
|
|
81
88
|
|
82
89
|
ssh_opts_append = opts[:ssh_opts_append].to_s # provided by user
|
83
90
|
|
91
|
+
# Support for user provided mount_options, owner, group
|
92
|
+
# https://github.com/hashicorp/vagrant/blob/2c3397c46851ef29a3589bf3214a3eee12da8484/website/content/docs/synced-folders/basic_usage.mdx#options
|
93
|
+
mount_options = opts.fetch(:mount_options, [])
|
94
|
+
if (opts.has_key?(:owner) and opts[:owner]) or
|
95
|
+
(opts.has_key?(:group) and opts[:group])
|
96
|
+
# Identify the uid
|
97
|
+
if opts.has_key?(:owner) and opts[:owner]
|
98
|
+
mount_uid = Etc::getpwnam(opts[:owner]).uid
|
99
|
+
else
|
100
|
+
mount_uid = Etc::getpwnam(Etc.getlogin).uid
|
101
|
+
end
|
102
|
+
# Identify the gid. If a group was provided use that otherwise use
|
103
|
+
# the group detected with the detected user id.
|
104
|
+
if opts.has_key?(:group) and opts[:group]
|
105
|
+
mount_gid = Etc::getgrnam(opts[:group]).gid
|
106
|
+
else
|
107
|
+
mount_gid = Etc::getpwnam(Etc.getlogin).gid
|
108
|
+
end
|
109
|
+
# Add them to the mount options
|
110
|
+
mount_options.append("uid=#{mount_uid}")
|
111
|
+
mount_options.append("gid=#{mount_gid}")
|
112
|
+
end
|
113
|
+
|
84
114
|
# SSHFS executable options
|
85
115
|
sshfs_opts = opts[:sshfs_opts]
|
86
116
|
sshfs_opts_append = opts[:sshfs_opts_append].to_s # provided by user
|
117
|
+
if not mount_options.empty?()
|
118
|
+
sshfs_opts_append+= ' -o ' + mount_options.join(',') + ' '
|
119
|
+
end
|
87
120
|
|
88
121
|
username = machine.ssh_info[:username]
|
89
122
|
host = machine.ssh_info[:host]
|
data/lib/vagrant-sshfs/plugin.rb
CHANGED
@@ -107,6 +107,26 @@ module VagrantPlugins
|
|
107
107
|
VagrantPlugins::GuestCentOS::Cap::SSHFSClient
|
108
108
|
end
|
109
109
|
|
110
|
+
guest_capability("rocky", "sshfs_installed") do
|
111
|
+
require_relative "cap/guest/rocky/sshfs_client"
|
112
|
+
VagrantPlugins::GuestRocky::Cap::SSHFSClient
|
113
|
+
end
|
114
|
+
|
115
|
+
guest_capability("rocky", "sshfs_install") do
|
116
|
+
require_relative "cap/guest/rocky/sshfs_client"
|
117
|
+
VagrantPlugins::GuestRocky::Cap::SSHFSClient
|
118
|
+
end
|
119
|
+
|
120
|
+
guest_capability("alma", "sshfs_installed") do
|
121
|
+
require_relative "cap/guest/alma/sshfs_client"
|
122
|
+
VagrantPlugins::GuestAlma::Cap::SSHFSClient
|
123
|
+
end
|
124
|
+
|
125
|
+
guest_capability("alma", "sshfs_install") do
|
126
|
+
require_relative "cap/guest/alma/sshfs_client"
|
127
|
+
VagrantPlugins::GuestAlma::Cap::SSHFSClient
|
128
|
+
end
|
129
|
+
|
110
130
|
guest_capability("fedora", "sshfs_installed") do
|
111
131
|
require_relative "cap/guest/fedora/sshfs_client"
|
112
132
|
VagrantPlugins::GuestFedora::Cap::SSHFSClient
|
data/test/misc/README.txt
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
# To test we will first create the directory on the machine where
|
6
6
|
# we will mount the guest /etc/ into the host (the reverse mount).
|
7
7
|
|
8
|
-
mkdir /tmp/
|
8
|
+
mkdir /tmp/reverse_mount_etc_uid_gid/
|
9
9
|
|
10
10
|
# Next we will define where our 3rd party host is (the normal mount).
|
11
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'
|
12
|
+
export THIRD_PARTY_HOST='192.168.121.73'
|
13
|
+
export THIRD_PARTY_HOST_USER='vagrant'
|
14
14
|
export THIRD_PARTY_HOST_PASS='vagrant'
|
15
15
|
|
16
16
|
# Open an extra file descriptor to test it is not passed onto child processes
|
@@ -18,27 +18,33 @@ export THIRD_PARTY_HOST_PASS='vagrant'
|
|
18
18
|
tmpfile=$(mktemp)
|
19
19
|
exec {extra_fd}<> "$tmpfile"
|
20
20
|
|
21
|
-
# Next vagrant up - will do
|
21
|
+
# Next vagrant up - will do 5 mounts
|
22
22
|
# - slave
|
23
|
+
# - slave with owner/group
|
23
24
|
# - slave with sym link
|
24
|
-
# - normal
|
25
|
-
# - reverse
|
25
|
+
# - normal (from 3rd party host)
|
26
|
+
# - reverse with owner/group
|
26
27
|
vagrant up
|
27
28
|
|
28
29
|
# Next run the script to test the mounts:
|
29
30
|
$ bash dotests.sh
|
30
31
|
Testing slave forward mount!
|
31
|
-
|
32
|
+
1358d4a18a2d4ba7be380b991e899952
|
33
|
+
Testing slave forward mount with owner/group!
|
34
|
+
root:wheel
|
35
|
+
1358d4a18a2d4ba7be380b991e899952
|
32
36
|
Testing slave forward mount with a symlink!
|
33
|
-
|
37
|
+
1358d4a18a2d4ba7be380b991e899952
|
34
38
|
Testing normal forward mount!
|
35
|
-
|
36
|
-
Testing reverse mount!
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
ef56862ae88f43c0a81962ba6f68a668
|
40
|
+
Testing reverse mount with owner/group!
|
41
|
+
root:wheel
|
42
|
+
ef4f3b50e2034b3593a9eb8b71350abe
|
43
|
+
|
44
|
+
# We are printing out the machine-id under each mount. The first three
|
45
|
+
should be the same, because they are from the same machine (the host).
|
46
|
+
The last two should be different; one from 3rd party machine and one
|
47
|
+
from the test VM itself (read from the host).
|
42
48
|
|
43
49
|
# Close our file descriptor. No other process should be using it
|
44
50
|
exec {extra_fd}>&-
|
data/test/misc/Vagrantfile
CHANGED
@@ -1,28 +1,47 @@
|
|
1
1
|
Vagrant.configure(2) do |config|
|
2
2
|
|
3
|
-
config.ssh.insert_key =
|
3
|
+
config.ssh.insert_key = true
|
4
4
|
|
5
5
|
# Test a forward slave mount:
|
6
6
|
# mounting /etc/ from the vagrant host into the guest
|
7
|
-
config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc/",
|
7
|
+
config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc/",
|
8
|
+
type: "sshfs",
|
9
|
+
mount_options: ['ro']
|
10
|
+
|
11
|
+
# Test a forward slave with owner/group info:
|
12
|
+
# mounting /etc/ from the vagrant host into the guest
|
13
|
+
config.vm.synced_folder "/etc/", "/tmp/forward_slave_mount_etc_uid_gid/",
|
14
|
+
type: "sshfs",
|
15
|
+
mount_options: ['ro', 'default_permissions'],
|
16
|
+
owner: "root",
|
17
|
+
group: "wheel"
|
8
18
|
|
9
19
|
# Test a forward mount to a location that is a symbolic link
|
10
20
|
# https://github.com/dustymabe/vagrant-sshfs/issues/44
|
11
|
-
config.vm.synced_folder "/etc/", "/var/run/forward_slave_mount_sym_link_test/",
|
21
|
+
config.vm.synced_folder "/etc/", "/var/run/forward_slave_mount_sym_link_test/",
|
22
|
+
type: "sshfs",
|
23
|
+
mount_options: ['ro']
|
12
24
|
|
13
25
|
# Test a forward normal mount:
|
14
26
|
# mounting a folder from a 3rd party host into guest
|
15
|
-
config.vm.synced_folder "/etc/", "/tmp/forward_normal_mount_etc/",
|
27
|
+
config.vm.synced_folder "/etc/", "/tmp/forward_normal_mount_etc/",
|
28
|
+
type: "sshfs",
|
16
29
|
ssh_host: ENV['THIRD_PARTY_HOST'],
|
17
30
|
ssh_username: ENV['THIRD_PARTY_HOST_USER'],
|
18
|
-
ssh_password: ENV['THIRD_PARTY_HOST_PASS']
|
31
|
+
ssh_password: ENV['THIRD_PARTY_HOST_PASS'],
|
32
|
+
mount_options: ['ro']
|
19
33
|
|
20
|
-
# Test a reverse mount
|
34
|
+
# Test a reverse mount with owner/group
|
21
35
|
# mounting /etc/ from vagrant guest into vagrant host
|
22
|
-
config.vm.synced_folder "/tmp/
|
36
|
+
config.vm.synced_folder "/tmp/reverse_mount_etc_uid_gid/", "/etc",
|
37
|
+
type: "sshfs",
|
38
|
+
reverse: true,
|
39
|
+
owner: "root",
|
40
|
+
group: "wheel",
|
41
|
+
mount_options: ['ro']
|
23
42
|
|
24
43
|
host = 'sshfs-tests'
|
25
|
-
box = 'fedora/
|
44
|
+
box = 'fedora/36-cloud-base'
|
26
45
|
|
27
46
|
config.vm.define host do | tmp |
|
28
47
|
tmp.vm.hostname = host
|
data/test/misc/dotests.sh
CHANGED
@@ -6,6 +6,11 @@ set -eu
|
|
6
6
|
echo -en "Testing slave forward mount!\n\t"
|
7
7
|
vagrant ssh -- cat /tmp/forward_slave_mount_etc/machine-id
|
8
8
|
|
9
|
+
echo -en "Testing slave forward mount with owner/group!\n\t"
|
10
|
+
vagrant ssh -- stat --printf '%U:%G' /tmp/forward_slave_mount_etc_uid_gid
|
11
|
+
echo -en "\n\t"
|
12
|
+
vagrant ssh -- cat /tmp/forward_slave_mount_etc_uid_gid/machine-id
|
13
|
+
|
9
14
|
# https://github.com/dustymabe/vagrant-sshfs/issues/44
|
10
15
|
echo -en "Testing slave forward mount with a symlink!\n\t"
|
11
16
|
vagrant ssh -- cat /run/forward_slave_mount_sym_link_test/machine-id
|
@@ -13,5 +18,7 @@ vagrant ssh -- cat /run/forward_slave_mount_sym_link_test/machine-id
|
|
13
18
|
echo -en "Testing normal forward mount!\n\t"
|
14
19
|
vagrant ssh -- cat /tmp/forward_normal_mount_etc/machine-id
|
15
20
|
|
16
|
-
echo -en "Testing reverse mount!\n\t"
|
17
|
-
|
21
|
+
echo -en "Testing reverse mount with owner/group!\n\t"
|
22
|
+
stat --printf '%U:%G' /tmp/reverse_mount_etc_uid_gid/
|
23
|
+
echo -en "\n\t"
|
24
|
+
cat /tmp/reverse_mount_etc_uid_gid/machine-id
|
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.
|
4
|
+
version: 1.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dusty Mabe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: win32-process
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- build.sh
|
70
70
|
- lib/vagrant-sshfs.rb
|
71
71
|
- lib/vagrant-sshfs/action_hostpath_fixup.rb
|
72
|
+
- lib/vagrant-sshfs/cap/guest/alma/sshfs_client.rb
|
72
73
|
- lib/vagrant-sshfs/cap/guest/alpine/sshfs_client.rb
|
73
74
|
- lib/vagrant-sshfs/cap/guest/arch/sshfs_client.rb
|
74
75
|
- lib/vagrant-sshfs/cap/guest/centos/sshfs_client.rb
|
@@ -80,6 +81,7 @@ files:
|
|
80
81
|
- lib/vagrant-sshfs/cap/guest/linux/sshfs_forward_mount.rb
|
81
82
|
- lib/vagrant-sshfs/cap/guest/linux/sshfs_get_absolute_path.rb
|
82
83
|
- lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb
|
84
|
+
- lib/vagrant-sshfs/cap/guest/rocky/sshfs_client.rb
|
83
85
|
- lib/vagrant-sshfs/cap/guest/suse/sshfs_client.rb
|
84
86
|
- lib/vagrant-sshfs/cap/host/darwin/sshfs_reverse_mount.rb
|
85
87
|
- lib/vagrant-sshfs/cap/host/linux/sshfs_reverse_mount.rb
|
@@ -114,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
116
|
- !ruby/object:Gem::Version
|
115
117
|
version: '0'
|
116
118
|
requirements: []
|
117
|
-
rubygems_version: 3.
|
119
|
+
rubygems_version: 3.2.33
|
118
120
|
signing_key:
|
119
121
|
specification_version: 4
|
120
122
|
summary: 'A Vagrant synced folder plugin that mounts folders via SSHFS. This is the
|