diff --git a/plugins/guests/redhat/cap/flavor.rb b/plugins/guests/redhat/cap/flavor.rb index 544af5412..b1187bd09 100644 --- a/plugins/guests/redhat/cap/flavor.rb +++ b/plugins/guests/redhat/cap/flavor.rb @@ -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 diff --git a/test/unit/plugins/guests/redhat/cap/flavor_test.rb b/test/unit/plugins/guests/redhat/cap/flavor_test.rb index df890783f..0aa26943e 100644 --- a/test/unit/plugins/guests/redhat/cap/flavor_test.rb +++ b/test/unit/plugins/guests/redhat/cap/flavor_test.rb @@ -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|