Support centos flavors of redhat

This commit is contained in:
sophia 2020-04-03 14:27:44 -04:00
parent d87d421586
commit d500daea03
2 changed files with 11 additions and 5 deletions

View file

@ -10,9 +10,15 @@ module VagrantPlugins
end
# Detect various flavors we care about
if output =~ /(CentOS|Red Hat Enterprise|Scientific|Cloud|Virtuozzo)\s*Linux( .+)? release 7/i
if output =~ /(CentOS)( .+)? 7/i
return :centos_7
elsif output =~ /(CentOS)( .+)? 8/i
return :centos_8
elsif output =~ /(CentOS)( .+)?/i
return :centos
elsif output =~ /(Red Hat Enterprise|Scientific|Cloud|Virtuozzo)\s*Linux( .+)? release 7/i
return :rhel_7
elsif output =~ /(CentOS|Red Hat Enterprise|Scientific|Cloud|Virtuozzo)\s*Linux( .+)? release 8/i
elsif output =~ /(Red Hat Enterprise|Scientific|Cloud|Virtuozzo)\s*Linux( .+)? release 8/i
return :rhel_8
else
return :rhel

View file

@ -22,15 +22,15 @@ describe "VagrantPlugins::GuestRedHat::Cap::Flavor" do
let(:cap) { caps.get(:flavor) }
{
"CentOS Linux 2.4 release 7" => :rhel_7,
"CentOS Linux 2.4 release 7" => :centos_7,
"Red Hat Enterprise Linux release 7" => :rhel_7,
"Scientific Linux release 7" => :rhel_7,
"CloudLinux release 7.2 (Valeri Kubasov)" => :rhel_7,
"CentOS Linux release 8.1.1911 (Core)" => :rhel_8,
"CentOS Linux release 8.1.1911 (Core)" => :centos_8,
"Red Hat Enterprise Linux release 8" => :rhel_8,
"CentOS" => :rhel,
"CentOS" => :centos,
"RHEL 6" => :rhel,
"banana" => :rhel,
}.each do |str, expected|