Fix exit code failure

Be less precise on the exit code and lot the exit code to the journal when it fails.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2019-09-17 09:04:22 -04:00
parent 799aa7022b
commit 34d22a4e5c
2 changed files with 9 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import (
"strings"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
)
const (
@ -39,8 +40,9 @@ func ExitCode(err error) int {
return 0
}
e := strings.ToLower(err.Error())
if strings.Contains(e, "file not found") ||
strings.Contains(e, "no such file or directory") {
logrus.Debugf("ExitCode msg: %q", e)
if strings.Contains(e, "not found") ||
strings.Contains(e, "no such file") {
return ExecErrorCodeNotFound
}