Skip to content

Commit

Permalink
fix(scanner/amazon): set major version
Browse files Browse the repository at this point in the history
  • Loading branch information
MaineK00n committed Mar 15, 2024
1 parent 426eb53 commit d32ca7a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scanner/redhatbase.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ func detectRedhat(c config.ServerInfo) (bool, osTypeInterface) {
// $ cat /etc/amazon-linux-release
// Amazon Linux release 2022 (Amazon Linux)
// Amazon Linux release 2023 (Amazon Linux)
// Amazon Linux release 2023.3.20240312 (Amazon Linux)
if r := exec(c, "cat /etc/amazon-linux-release", noSudo); r.isSuccess() {
amazon := newAmazon(c)
result := releasePattern.FindStringSubmatch(strings.TrimSpace(r.Stdout))
Expand All @@ -212,7 +213,7 @@ func detectRedhat(c config.ServerInfo) (bool, osTypeInterface) {
}
switch strings.ToLower(result[1]) {
case "amazon", "amazon linux":
amazon.setDistro(constant.Amazon, release)
amazon.setDistro(constant.Amazon, fmt.Sprintf("%d", major))
return true, amazon
default:
amazon.setErrs([]error{xerrors.Errorf("Failed to parse Amazon Linux Name. release: %s", release)})
Expand Down

0 comments on commit d32ca7a

Please sign in to comment.