Codebase list vuls / 6d33985
fix: support CentOS cloud image (#606) https://bugzilla.redhat.com/show_bug.cgi?id=1332025 Kota Kanbe authored 6 years ago GitHub committed 6 years ago
2 changed file(s) with 23 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
377377 }
378378 }
379379 for _, cType := range cTypes {
380 if equal := prevLastModified[cType].Equal(curLastModified[cType]); !equal {
380 if !prevLastModified[cType].Equal(curLastModified[cType]) {
381381 return true
382382 }
383383 }
7474 release := result[2]
7575 red.setDistro(config.Oracle, release)
7676 return true, red
77 }
78 }
79
80 // https://bugzilla.redhat.com/show_bug.cgi?id=1332025
81 // CentOS cloud image
82 if r := exec(c, "ls /etc/centos-release", noSudo); r.isSuccess() {
83 if r := exec(c, "cat /etc/centos-release", noSudo); r.isSuccess() {
84 re := regexp.MustCompile(`(.*) release (\d[\d\.]*)`)
85 result := re.FindStringSubmatch(strings.TrimSpace(r.Stdout))
86 if len(result) != 3 {
87 util.Log.Warn("Failed to parse CentOS version: %s", r)
88 return true, red
89 }
90
91 release := result[2]
92 switch strings.ToLower(result[1]) {
93 case "centos", "centos linux":
94 red.setDistro(config.CentOS, release)
95 return true, red
96 default:
97 util.Log.Warn("Failed to parse CentOS: %s", r)
98 }
7799 }
78100 }
79101