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
377 | 377 |
}
|
378 | 378 |
}
|
379 | 379 |
for _, cType := range cTypes {
|
380 | |
if equal := prevLastModified[cType].Equal(curLastModified[cType]); !equal {
|
|
380 |
if !prevLastModified[cType].Equal(curLastModified[cType]) {
|
381 | 381 |
return true
|
382 | 382 |
}
|
383 | 383 |
}
|
74 | 74 |
release := result[2]
|
75 | 75 |
red.setDistro(config.Oracle, release)
|
76 | 76 |
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 |
}
|
77 | 99 |
}
|
78 | 100 |
}
|
79 | 101 |
|