diff --git a/lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb b/lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb index 28491e5..aaf49ac 100644 --- a/lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb +++ b/lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb @@ -3,27 +3,13 @@ module GuestRedHat module Cap class SSHFSClient def self.sshfs_install(machine) - - rhel_version = machine.guest.capability("flavor") - - # Handle the case where Vagrant doesn't yet know how to - # detect and return :rhel_8 https://github.com/hashicorp/vagrant/pull/11453 - if Gem::Version.new(Vagrant::VERSION) < Gem::Version.new('2.2.8') - rhel_version = vagrant_lt_228_flavor_compat(machine) + # Install epel rpm if not installed + if !epel_installed(machine) + epel_install(machine) end - case rhel_version - when :rhel_8 - # No need to install epel. fuse-sshfs comes from the PowerTools repo - # https://bugzilla.redhat.com/show_bug.cgi?id=1758884 - machine.communicate.sudo("yum -y install --enablerepo=PowerTools fuse-sshfs") - when :rhel_7, :rhel # rhel7 and rhel6 - # Install fuse-sshfs from epel - if !epel_installed(machine) - epel_install(machine) - end - machine.communicate.sudo("yum -y install fuse-sshfs") - end + # Install sshfs (comes from epel repos) + machine.communicate.sudo("yum -y install fuse-sshfs") end def self.sshfs_installed(machine) @@ -37,23 +23,11 @@ def self.epel_installed(machine) end def self.epel_install(machine) - machine.communicate.sudo("yum -y install epel-release") - end - - def self.vagrant_lt_228_flavor_compat(machine) - # This is a compatibility function to handle RHEL8 for - # vagrant versions that didn't include: - # https://github.com/hashicorp/vagrant/pull/11453 - output = "" - machine.communicate.sudo("cat /etc/redhat-release") do |_, data| - output = data - end - if output =~ /(CentOS|Red Hat Enterprise|Scientific|Cloud|Virtuozzo)\s*Linux( .+)? release 8/i - return :rhel_8 - elsif output =~ /(CentOS|Red Hat Enterprise|Scientific|Cloud|Virtuozzo)\s*Linux( .+)? release 7/i - return :rhel_7 - else - return :rhel + case machine.guest.capability("flavor") + when :rhel_7 + machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm") + when :rhel # rhel6 + machine.communicate.sudo("rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm") end end end