Skip to content

Commit cc3cb7f

Browse files
hemant300720Hemant Narbhavar
andauthored
added rhel9.8 support for pf9ctl (#429)
* added rhel9.8 support for pf9ctl * split rhel9 and rocky9 checks --------- Co-authored-by: Hemant Narbhavar <hemantnarbhavar@Mac.localdomain>
1 parent 3d58330 commit cc3cb7f

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

‎pkg/platform/centos/centos.go‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,26 @@ func (c *CentOS) CheckExistingInstallation() (bool, error) {
131131

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

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

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

141142
if platform.SkipOSChecks {
142143
rhel8, _ = regexp.MatchString(`8\.\d{1,2}`, string(version))
143144
rocky9, _ = regexp.MatchString(`9\.\d{1,2}`, string(version))
145+
rhel9, _ = regexp.MatchString(`9\.\d{1,2}`, string(version))
144146
}
145147
for _, p := range packages {
146-
if !centos && (rhel8 || rocky9) {
148+
if !centos && (rhel8 || rocky9 || rhel9) {
147149
switch p {
148150
case "policycoreutils-python":
149151
if rhel8 {
150152
p = "python3-policycoreutils"
151-
} else if rocky9 {
153+
} else if rocky9 || rhel9 {
152154
p = "policycoreutils-python-utils"
153155
}
154156

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

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

182-
var centos, rhel8 bool
184+
var centos, rhel8, rhel9 bool
183185
centos, _ = regexp.MatchString(`.*7\.[3-9]\.*`, string(version))
184186
rhel8, _ = regexp.MatchString(`.*8\.([5-9]|1[0])\.*`, string(version))
187+
rhel9, _ = regexp.MatchString(`.*9\.8\.*`, string(version))
185188

186189
if platform.SkipOSChecks {
187190
centos, _ = regexp.MatchString(`7\.\d{1,2}`, string(version))
188191
rhel8, _ = regexp.MatchString(`8\.\d{1,2}`, string(version))
192+
rhel9, _ = regexp.MatchString(`9\.\d{1,2}`, string(version))
189193
}
190194

191195
output, err := c.exec.RunWithStdout("bash", "-c", "yum repolist")
@@ -213,6 +217,14 @@ func (c *CentOS) CheckEnabledRepos() (bool, error) {
213217
if !strings.Contains(string(output), "AppStream") {
214218
enable_repos = append(enable_repos, "rhel-8-for-x86_64-appstream-rpms")
215219
}
220+
} else if rhel9 {
221+
command = "subscription-manager repos --enable %s"
222+
if !strings.Contains(string(output), "BaseOS") {
223+
enable_repos = append(enable_repos, "rhel-9-for-x86_64-baseos-rpms")
224+
}
225+
if !strings.Contains(string(output), "AppStream") {
226+
enable_repos = append(enable_repos, "rhel-9-for-x86_64-appstream-rpms")
227+
}
216228
}
217229

218230
for _, r := range enable_repos {
@@ -379,7 +391,7 @@ func (c *CentOS) Version() (string, error) {
379391
return "redhat", nil
380392
}
381393
}
382-
if match, _ := regexp.MatchString(`.*7\.[3-9]\.*|.*8\.([5-9]|1[0])\.*|.*9\.[1-5]\.*`, string(version)); match {
394+
if match, _ := regexp.MatchString(`.*7\.[3-9]\.*|.*8\.([5-9]|1[0])\.*|.*9\.([1-5]|8)\.*`, string(version)); match {
383395
return "redhat", nil
384396
}
385397
return "", fmt.Errorf("Unable to determine OS type: %s", string(version))

‎pkg/pmk/checkNode.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func CheckNode(ctx objects.Config, allClients client.Client, auth keystone.Keyst
6565
case "redhat":
6666
platform = centos.NewCentOS(allClients.Executor)
6767
default:
68-
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]")
68+
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]")
6969
}
7070

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

0 commit comments

Comments
 (0)