From 97952932cdf20d435fafec0c4c8eb0148f276694 Mon Sep 17 00:00:00 2001 From: manasabsv26 Date: Fri, 21 Jun 2024 16:54:28 +0530 Subject: [PATCH] Minor changes --- pkg/platform/centos/centos.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/pkg/platform/centos/centos.go b/pkg/platform/centos/centos.go index d7be927..012fe8d 100644 --- a/pkg/platform/centos/centos.go +++ b/pkg/platform/centos/centos.go @@ -131,11 +131,17 @@ func (c *CentOS) CheckExistingInstallation() (bool, error) { func (c *CentOS) checkOSPackages() (bool, error) { + var rhel8, rocky9 bool errLines := []string{packageInstallError} zap.S().Debug("Checking OS Packages") - rhel8, _ := regexp.MatchString(`.*8\.[5-9]\.*`, string(version)) - rocky9, _ := regexp.MatchString(`.*9\.[1-2]\.*`, string(version)) + rhel8, _ = regexp.MatchString(`.*8\.[5-9]\.*`, string(version)) + rocky9, _ = regexp.MatchString(`.*9\.[1-2]\.*`, string(version)) + + if platform.SkipOSChecks { + rhel8, _ = regexp.MatchString(`8\.\d{1,2}`, string(version)) + rocky9, _ = regexp.MatchString(`9\.\d{1,2}`, string(version)) + } for _, p := range packages { if !centos && (rhel8 || rocky9) { switch p { @@ -173,8 +179,14 @@ func (c *CentOS) checkOSPackages() (bool, error) { func (c *CentOS) checkEnabledRepos() (bool, error) { - centos, _ := regexp.MatchString(`.*7\.[3-9]\.*`, string(version)) - rhel8, _ := regexp.MatchString(`.*8\.[5-9]\.*`, string(version)) + var centos, rhel8 bool + centos, _ = regexp.MatchString(`.*7\.[3-9]\.*`, string(version)) + rhel8, _ = regexp.MatchString(`.*8\.[5-9]\.*`, string(version)) + + if platform.SkipOSChecks { + centos, _ = regexp.MatchString(`7\.\d{1,2}`, string(version)) + rhel8, _ = regexp.MatchString(`8\.\d{1,2}`, string(version)) + } output, err := c.exec.RunWithStdout("bash", "-c", "yum repolist") if err != nil {