From cc7d3dc2aad6046e46d7bab4c0f9851c256d7b05 Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Mon, 13 Mar 2017 16:50:47 +0900 Subject: [PATCH] Obsolete CentOS5 --- README.ja.md | 2 +- README.md | 2 +- scan/redhat.go | 20 ++++++++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.ja.md b/README.ja.md index 8236052b..07bfb2e4 100644 --- a/README.ja.md +++ b/README.ja.md @@ -397,7 +397,7 @@ web/app server in the same configuration under the load balancer | Ubuntu | 12, 14, 16| | Debian | 7, 8| | RHEL | 5, 6, 7| -| CentOS | 5, 6, 7| +| CentOS | 6, 7| | Amazon Linux| All| | FreeBSD | 10, 11| | Raspbian | Wheezy, Jessie | diff --git a/README.md b/README.md index 2bbd2662..90655ff9 100644 --- a/README.md +++ b/README.md @@ -398,7 +398,7 @@ If there is a staging environment with the same configuration as the production | Ubuntu | 12, 14, 16| | Debian | 7, 8| | RHEL | 5, 6, 7| -| CentOS | 5, 6, 7| +| CentOS | 6, 7| | Amazon Linux| All| | FreeBSD | 10, 11| | Raspbian | Wheezy, Jessie | diff --git a/scan/redhat.go b/scan/redhat.go index c7bb44e7..c5faae58 100644 --- a/scan/redhat.go +++ b/scan/redhat.go @@ -151,7 +151,6 @@ func (o *redhat) checkIfSudoNoPasswd() error { return nil } -// CentOS 5 ... yum-changelog // CentOS 6, 7 ... yum-plugin-changelog // RHEL 5 ... yum-security // RHEL 6, 7 ... - @@ -169,12 +168,25 @@ func (o *redhat) checkDependencies() error { return fmt.Errorf(msg) } + if o.Distro.Family == "centos" { + if majorVersion < 6 { + msg := fmt.Sprintf("CentOS %s is not supported", o.Distro.Release) + o.log.Errorf(msg) + return fmt.Errorf(msg) + } + + // --assumeno option of yum is needed. + cmd := "yum -h | grep assumeno" + if r := o.exec(cmd, noSudo); !r.isSuccess() { + msg := fmt.Sprintf("Installed yum is old. Please update yum and then retry") + o.log.Errorf(msg) + return fmt.Errorf(msg) + } + } + switch o.Distro.Family { case "centos": packName = "yum-plugin-changelog" - if majorVersion < 6 { - packName = "yum-changelog" - } case "rhel": if majorVersion < 6 { packName = "yum-security"