diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-01-06 23:42:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 23:42:09 +0100 |
commit | 8a2238440635d497dbdacceb6826c850582766ea (patch) | |
tree | 72e03b69c79e2f2cffc4e0a7d027effd36e9a9bc /libpod/oci_util.go | |
parent | 3ac1219cbcfe8ccd83ed7b73b92e1d6f13abf550 (diff) | |
parent | 1941d45e327c54eb054d6f63d852dfebfe19c18b (diff) | |
download | podman-8a2238440635d497dbdacceb6826c850582766ea.tar.gz podman-8a2238440635d497dbdacceb6826c850582766ea.tar.bz2 podman-8a2238440635d497dbdacceb6826c850582766ea.zip |
Merge pull request #12758 from rhatdan/runtime
add OCI Runtime name to errors
Diffstat (limited to 'libpod/oci_util.go')
-rw-r--r-- | libpod/oci_util.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libpod/oci_util.go b/libpod/oci_util.go index 6d99d5836..06d1dc652 100644 --- a/libpod/oci_util.go +++ b/libpod/oci_util.go @@ -136,7 +136,7 @@ func bindPort(protocol, hostIP string, port uint16, isV6 bool, sctpWarning *bool return file, nil } -func getOCIRuntimeError(runtimeMsg string) error { +func getOCIRuntimeError(name, runtimeMsg string) error { includeFullOutput := logrus.GetLevel() == logrus.DebugLevel if match := regexp.MustCompile("(?i).*permission denied.*|.*operation not permitted.*").FindString(runtimeMsg); match != "" { @@ -144,14 +144,14 @@ func getOCIRuntimeError(runtimeMsg string) error { if includeFullOutput { errStr = runtimeMsg } - return errors.Wrapf(define.ErrOCIRuntimePermissionDenied, "%s", strings.Trim(errStr, "\n")) + return errors.Wrapf(define.ErrOCIRuntimePermissionDenied, "%s: %s", name, strings.Trim(errStr, "\n")) } if match := regexp.MustCompile("(?i).*executable file not found in.*|.*no such file or directory.*").FindString(runtimeMsg); match != "" { errStr := match if includeFullOutput { errStr = runtimeMsg } - return errors.Wrapf(define.ErrOCIRuntimeNotFound, "%s", strings.Trim(errStr, "\n")) + return errors.Wrapf(define.ErrOCIRuntimeNotFound, "%s: %s", name, strings.Trim(errStr, "\n")) } if match := regexp.MustCompile("`/proc/[a-z0-9-].+/attr.*`").FindString(runtimeMsg); match != "" { errStr := match @@ -159,11 +159,11 @@ func getOCIRuntimeError(runtimeMsg string) error { errStr = runtimeMsg } if strings.HasSuffix(match, "/exec`") { - return errors.Wrapf(define.ErrSetSecurityAttribute, "%s", strings.Trim(errStr, "\n")) + return errors.Wrapf(define.ErrSetSecurityAttribute, "%s: %s", name, strings.Trim(errStr, "\n")) } else if strings.HasSuffix(match, "/current`") { - return errors.Wrapf(define.ErrGetSecurityAttribute, "%s", strings.Trim(errStr, "\n")) + return errors.Wrapf(define.ErrGetSecurityAttribute, "%s: %s", name, strings.Trim(errStr, "\n")) } - return errors.Wrapf(define.ErrSecurityAttribute, "%s", strings.Trim(errStr, "\n")) + return errors.Wrapf(define.ErrSecurityAttribute, "%s: %s", name, strings.Trim(errStr, "\n")) } - return errors.Wrapf(define.ErrOCIRuntime, "%s", strings.Trim(runtimeMsg, "\n")) + return errors.Wrapf(define.ErrOCIRuntime, "%s: %s", name, strings.Trim(runtimeMsg, "\n")) } |