From 1214d8c14d1310c1edbaf61755a2cb7778aa4909 Mon Sep 17 00:00:00 2001 From: Mai MISHIRO <33324303+mai346@users.noreply.github.com> Date: Tue, 12 Dec 2017 17:03:42 +0900 Subject: [PATCH] Change error handling of "Reboot Required" detection (#556) --- scan/redhat.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scan/redhat.go b/scan/redhat.go index 89ae7f05..01f7640e 100644 --- a/scan/redhat.go +++ b/scan/redhat.go @@ -262,8 +262,10 @@ func (o *redhat) scanPackages() error { func (o *redhat) rebootRequired() (bool, error) { r := o.exec("rpm -q --last kernel", noSudo) scanner := bufio.NewScanner(strings.NewReader(r.Stdout)) + if !r.isSuccess(0, 1) { + return false, fmt.Errorf("Failed to detect the last installed kernel : %v", r) + } if !r.isSuccess() || !scanner.Scan() { - o.log.Warn("Failed to detect the last installed kernel : %v", r) return false, nil } lastInstalledKernelVer := strings.Fields(scanner.Text())[0]