guests/centos: use GUEST_DETECTION_NAME='centos' to ID CentOS

This migrates the CentOS guest plugin to identify machines by
what is in os-release rather than based on if the /etc/centos-release
file exists.

It just so happens that the Rocky Linux plugin is set up to inherit
directly from :redhat (not :centos) and thus the CentOS flavor is
attempted before Rocky in the depth first search. For some reason
the rockylinux/8 vagrant box still has the /etc/centos-release file
in it even though it's only supposed to inherit from RHEL.

The almalinux/9 box does not have /etc/centos-release.
This commit is contained in:
Dusty Mabe 2022-06-03 18:37:42 -04:00 committed by sophia
parent 3b1e277f72
commit 4336aff67d

View File

@ -1,9 +1,11 @@
require "vagrant"
require_relative '../linux/guest'
module VagrantPlugins module VagrantPlugins
module GuestCentos module GuestCentos
class Guest < Vagrant.plugin("2", :guest) class Guest < VagrantPlugins::GuestLinux::Guest
def detect?(machine) # Name used for guest detection
machine.communicate.test("cat /etc/centos-release") GUEST_DETECTION_NAME = "centos".freeze
end
end end
end end
end end