From 5d039942cab68ca259629c16cd690252c4329062 Mon Sep 17 00:00:00 2001 From: Hemant Narbhavar Date: Mon, 21 Sep 2026 12:00:01 +0530 Subject: [PATCH 1/2] added rhel9.8 support for pf9ctl Co-Authored-By: Claude Sonnet 5 --- pkg/platform/centos/centos.go | 16 +++++++++++++--- pkg/pmk/checkNode.go | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pkg/platform/centos/centos.go b/pkg/platform/centos/centos.go index 424bebfa..3fbd7479 100644 --- a/pkg/platform/centos/centos.go +++ b/pkg/platform/centos/centos.go @@ -136,7 +136,7 @@ func (c *CentOS) CheckOSPackages() (bool, error) { zap.S().Debug("Checking OS Packages") rhel8, _ = regexp.MatchString(`.*8\.([5-9]|1[0])\.*`, string(version)) - rocky9, _ = regexp.MatchString(`.*9\.[1-5]\.*`, string(version)) + rocky9, _ = regexp.MatchString(`.*9\.([1-5]|8)\.*`, string(version)) if platform.SkipOSChecks { rhel8, _ = regexp.MatchString(`8\.\d{1,2}`, string(version)) @@ -179,13 +179,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)) 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") @@ -213,6 +215,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 { @@ -379,7 +389,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)) diff --git a/pkg/pmk/checkNode.go b/pkg/pmk/checkNode.go index 4dfe9a4b..09b87e9b 100644 --- a/pkg/pmk/checkNode.go +++ b/pkg/pmk/checkNode.go @@ -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 { From 515b901d09b5f228700b8641674bf03052b2ca23 Mon Sep 17 00:00:00 2001 From: Hemant Narbhavar Date: Mon, 21 Sep 2026 15:32:03 +0530 Subject: [PATCH 2/2] split rhel9 and rocky9 checks --- pkg/platform/centos/centos.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/platform/centos/centos.go b/pkg/platform/centos/centos.go index 3fbd7479..6d072a0c 100644 --- a/pkg/platform/centos/centos.go +++ b/pkg/platform/centos/centos.go @@ -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]|8)\.*`, 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" }