mirror of
https://github.com/containers/podman.git
synced 2025-09-08 21:02:21 +08:00
Merge pull request #17364 from eriksjolund/add_return
Add missing return after utils.Error()
This commit is contained in:
pkg/api/handlers
@ -201,6 +201,7 @@ func CreateImageFromSrc(w http.ResponseWriter, r *http.Request) {
|
||||
source = f.Name()
|
||||
if err := SaveFromBody(f, r); err != nil {
|
||||
utils.Error(w, http.StatusInternalServerError, fmt.Errorf("failed to write temporary file: %w", err))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,10 +188,12 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
||||
anchorDir, err := os.MkdirTemp(parse.GetTempDir(), "libpod_builder")
|
||||
if err != nil {
|
||||
utils.InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
tempDir, subDir, err := buildahDefine.TempDirForURL(anchorDir, "buildah", query.Remote)
|
||||
if err != nil {
|
||||
utils.InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
if tempDir != "" {
|
||||
// We had to download it to a temporary directory.
|
||||
@ -209,6 +211,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
||||
absDir, err := filepath.Abs(query.Remote)
|
||||
if err != nil {
|
||||
utils.BadRequest(w, "remote", query.Remote, err)
|
||||
return
|
||||
}
|
||||
contextDirectory = absDir
|
||||
}
|
||||
@ -232,6 +235,7 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
|
||||
containerFiles = []string{filepath.Join(contextDirectory, "Dockerfile")}
|
||||
if _, err1 := os.Stat(containerFiles[0]); err1 != nil {
|
||||
utils.BadRequest(w, "dockerfile", query.Dockerfile, err)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,6 +163,7 @@ func UnmountContainer(w http.ResponseWriter, r *http.Request) {
|
||||
// "container not mounted" error so we can surface that to the endpoint user
|
||||
if err := conn.Unmount(false); err != nil {
|
||||
utils.InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
utils.WriteResponse(w, http.StatusNoContent, "")
|
||||
}
|
||||
@ -178,6 +179,7 @@ func MountContainer(w http.ResponseWriter, r *http.Request) {
|
||||
m, err := conn.Mount()
|
||||
if err != nil {
|
||||
utils.InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
utils.WriteResponse(w, http.StatusOK, m)
|
||||
}
|
||||
@ -188,11 +190,13 @@ func ShowMountedContainers(w http.ResponseWriter, r *http.Request) {
|
||||
conns, err := runtime.GetAllContainers()
|
||||
if err != nil {
|
||||
utils.InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
for _, conn := range conns {
|
||||
mounted, mountPoint, err := conn.Mounted()
|
||||
if err != nil {
|
||||
utils.InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
if !mounted {
|
||||
continue
|
||||
|
@ -68,6 +68,7 @@ func UpdateNetwork(w http.ResponseWriter, r *http.Request) {
|
||||
err := ic.NetworkUpdate(r.Context(), name, networkUpdateOptions)
|
||||
if err != nil {
|
||||
utils.Error(w, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
|
||||
utils.WriteResponse(w, http.StatusNoContent, nil)
|
||||
|
Reference in New Issue
Block a user