Skip to content

Commit

Permalink
guest: redhat: reset back to pre-EL8 modifications
Browse files Browse the repository at this point in the history
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] hashicorp/vagrant@5104d07
  • Loading branch information
dustymabe committed Jun 29, 2020
1 parent 1a0f440 commit f4408e3
Showing 1 changed file with 10 additions and 36 deletions.
46 changes: 10 additions & 36 deletions lib/vagrant-sshfs/cap/guest/redhat/sshfs_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit f4408e3

Please sign in to comment.