Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions pkg/platform/centos/centos.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,26 @@ func (c *CentOS) CheckExistingInstallation() (bool, error) {

func (c *CentOS) CheckOSPackages() (bool, error) {

var rhel8, rocky9 bool
var rhel8, rocky9, rhel9 bool
errLines := []string{packageInstallError}
zap.S().Debug("Checking OS Packages")

rhel8, _ = regexp.MatchString(`.*8\.([5-9]|1[0])\.*`, string(version))
rocky9, _ = regexp.MatchString(`.*9\.[1-5]\.*`, string(version))
rhel9, _ = regexp.MatchString(`.*9\.8\.*`, string(version))

if platform.SkipOSChecks {
rhel8, _ = regexp.MatchString(`8\.\d{1,2}`, string(version))
rocky9, _ = regexp.MatchString(`9\.\d{1,2}`, string(version))
rhel9, _ = regexp.MatchString(`9\.\d{1,2}`, string(version))
}
for _, p := range packages {
if !centos && (rhel8 || rocky9) {
if !centos && (rhel8 || rocky9 || rhel9) {
switch p {
case "policycoreutils-python":
if rhel8 {
p = "python3-policycoreutils"
} else if rocky9 {
} else if rocky9 || rhel9 {
p = "policycoreutils-python-utils"
}

Expand Down Expand Up @@ -179,13 +181,15 @@ func (c *CentOS) CheckOSPackages() (bool, error) {

func (c *CentOS) CheckEnabledRepos() (bool, error) {

var centos, rhel8 bool
var centos, rhel8, rhel9 bool
centos, _ = regexp.MatchString(`.*7\.[3-9]\.*`, string(version))
rhel8, _ = regexp.MatchString(`.*8\.([5-9]|1[0])\.*`, string(version))
rhel9, _ = regexp.MatchString(`.*9\.8\.*`, string(version))
Comment thread
hemant300720 marked this conversation as resolved.

if platform.SkipOSChecks {
centos, _ = regexp.MatchString(`7\.\d{1,2}`, string(version))
rhel8, _ = regexp.MatchString(`8\.\d{1,2}`, string(version))
rhel9, _ = regexp.MatchString(`9\.\d{1,2}`, string(version))
}

output, err := c.exec.RunWithStdout("bash", "-c", "yum repolist")
Expand Down Expand Up @@ -213,6 +217,14 @@ func (c *CentOS) CheckEnabledRepos() (bool, error) {
if !strings.Contains(string(output), "AppStream") {
enable_repos = append(enable_repos, "rhel-8-for-x86_64-appstream-rpms")
}
} else if rhel9 {
command = "subscription-manager repos --enable %s"
if !strings.Contains(string(output), "BaseOS") {
enable_repos = append(enable_repos, "rhel-9-for-x86_64-baseos-rpms")
}
if !strings.Contains(string(output), "AppStream") {
enable_repos = append(enable_repos, "rhel-9-for-x86_64-appstream-rpms")
}
}

for _, r := range enable_repos {
Expand Down Expand Up @@ -379,7 +391,7 @@ func (c *CentOS) Version() (string, error) {
return "redhat", nil
}
}
if match, _ := regexp.MatchString(`.*7\.[3-9]\.*|.*8\.([5-9]|1[0])\.*|.*9\.[1-5]\.*`, string(version)); match {
if match, _ := regexp.MatchString(`.*7\.[3-9]\.*|.*8\.([5-9]|1[0])\.*|.*9\.([1-5]|8)\.*`, string(version)); match {
return "redhat", nil
}
return "", fmt.Errorf("Unable to determine OS type: %s", string(version))
Expand Down
2 changes: 1 addition & 1 deletion pkg/pmk/checkNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func CheckNode(ctx objects.Config, allClients client.Client, auth keystone.Keyst
case "redhat":
platform = centos.NewCentOS(allClients.Executor)
default:
return RequiredFail, fmt.Errorf("This OS is not supported. Supported operating systems are: Ubuntu (20.04, 22.04,24.04), CentOS 7.[3-9], RHEL 7.[3-9], RHEL 8.[5-10] & Rocky 9.[1-5]")
return RequiredFail, fmt.Errorf("This OS is not supported. Supported operating systems are: Ubuntu (20.04, 22.04,24.04), CentOS 7.[3-9], RHEL 7.[3-9], RHEL 8.[5-10], RHEL 9.8 & Rocky 9.[1-5]")
}

if err = allClients.Segment.SendEvent("Starting CheckNode", auth, checkPass, ""); err != nil {
Expand Down
Loading