From f4408e3bf4fd6017870c931519c01c2849690637 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Sun, 28 Jun 2020 23:56:51 -0400 Subject: [PATCH] guest: redhat: reset back to pre-EL8 modifications This is a revert of cd31a47 ac732ac and de0dfd7. In those commits we were trying to support CentOS and RHEL 8 better, but the changes ended up being mostly useful only for CentOS. Now that CentOS has it's own flavor detection in Vagrant and centos_8 and rhel_8 are properly supported [1] we definitely don't need de0dfd7 and we can also move the redhat module back to just supporting RHEL since dd02e09 handles CentOS for us. [1] https://github.com/hashicorp/vagrant/commit/5104d075bdeb8670db7aff6c8247506e6ca28a63 --- .../cap/guest/redhat/sshfs_client.rb | 46 ++++--------------- 1 file changed, 10 insertions(+), 36 deletions(-) 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