From 0416c3b561e6c735c174d2468b06ffc38eed112c Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Fri, 13 Jan 2017 04:56:59 +0900 Subject: [PATCH] Fix amazon linux scan stopped halfway --- scan/redhat.go | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/scan/redhat.go b/scan/redhat.go index 81a6548e95..8b13ac106c 100644 --- a/scan/redhat.go +++ b/scan/redhat.go @@ -579,15 +579,10 @@ func (o *redhat) scanUnsecurePackagesUsingYumPluginSecurity() (models.VulnInfos, return nil, fmt.Errorf("Not implemented yet: %s, err: %s", o.Distro, err) } - switch major { - case 5: - { - cmd = "yum --color=never list-security --security" - } - case 6, 7: - { - cmd = "yum --color=never updateinfo list available --security" - } + if o.Distro.Family == "centos" && major == 5 { + cmd = "yum --color=never list-security --security" + } else { + cmd = "yum --color=never updateinfo list available --security" } r = o.ssh(util.PrependProxyEnv(cmd), o.sudo()) if !r.isSuccess() { @@ -628,15 +623,10 @@ func (o *redhat) scanUnsecurePackagesUsingYumPluginSecurity() (models.VulnInfos, } // get advisoryID(RHSA, ALAS) - CVE IDs - switch major { - case 5: - { - cmd = "yum --color=never info-sec" - } - case 6, 7: - { - cmd = "yum --color=never updateinfo --security update" - } + if o.Distro.Family == "centos" && major == 5 { + cmd = "yum --color=never info-sec" + } else { + cmd = "yum --color=never updateinfo --security update" } r = o.ssh(util.PrependProxyEnv(cmd), o.sudo()) if !r.isSuccess() {