mirror of
https://github.com/containers/podman.git
synced 2026-10-22 01:45:09 -04:00
Lowercase some errors
This commit is courtesy of ``` for f in $(git ls-files *.go | grep -v ^vendor/); do \ sed -i 's/\(errors\..*\)"Error /\1"error /' $f; done for f in $(git ls-files *.go | grep -v ^vendor/); do \ sed -i 's/\(errors\..*\)"Failed to /\1"failed to /' $f; done ``` etc. Self-reviewed using `git diff --word-diff`, found no issues. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
1 parent
4878dff3e2
commit
684d0079d2
44 files changed
+117
-117
No files matched your search
@@ -132,7 +132,7 @@ func history(cmd *cobra.Command, args []string) error {
|
||||
w := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', 0)
|
||||
err = tmpl.Execute(w, hr)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, errors.Wrapf(err, "Failed to print report"))
|
||||
fmt.Fprintln(os.Stderr, errors.Wrapf(err, "failed to print report"))
|
||||
}
|
||||
w.Flush()
|
||||
return nil
|
||||
|
||||
@@ -166,7 +166,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL) (string, error) {
|
||||
value := cmd.Flag("identity").Value.String()
|
||||
auth, err := terminal.PublicKey(value, []byte(passwd))
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "Failed to read identity %q", value)
|
||||
return "", errors.Wrapf(err, "failed to read identity %q", value)
|
||||
}
|
||||
authMethods = append(authMethods, auth)
|
||||
}
|
||||
|
||||
@@ -919,7 +919,7 @@ func (c *Container) checkpoint(ctx context.Context, options ContainerCheckpointO
|
||||
func (c *Container) importCheckpoint(input string) error {
|
||||
archiveFile, err := os.Open(input)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Failed to open checkpoint archive for import")
|
||||
return errors.Wrap(err, "failed to open checkpoint archive for import")
|
||||
}
|
||||
|
||||
defer archiveFile.Close()
|
||||
@@ -1116,11 +1116,11 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
|
||||
// Only do this if a rootfs-diff.tar actually exists
|
||||
rootfsDiffFile, err := os.Open(rootfsDiffPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Failed to open root file-system diff file")
|
||||
return errors.Wrap(err, "failed to open root file-system diff file")
|
||||
}
|
||||
defer rootfsDiffFile.Close()
|
||||
if err := c.runtime.ApplyDiffTarStream(c.ID(), rootfsDiffFile); err != nil {
|
||||
return errors.Wrapf(err, "Failed to apply root file-system diff file %s", rootfsDiffPath)
|
||||
return errors.Wrapf(err, "failed to apply root file-system diff file %s", rootfsDiffPath)
|
||||
}
|
||||
}
|
||||
deletedFilesPath := filepath.Join(c.bundlePath(), "deleted.files")
|
||||
@@ -1128,17 +1128,17 @@ func (c *Container) restore(ctx context.Context, options ContainerCheckpointOpti
|
||||
var deletedFiles []string
|
||||
deletedFilesJSON, err := ioutil.ReadFile(deletedFilesPath)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to read deleted files file")
|
||||
return errors.Wrapf(err, "failed to read deleted files file")
|
||||
}
|
||||
if err := json.Unmarshal(deletedFilesJSON, &deletedFiles); err != nil {
|
||||
return errors.Wrapf(err, "Failed to read deleted files file %s", deletedFilesPath)
|
||||
return errors.Wrapf(err, "failed to read deleted files file %s", deletedFilesPath)
|
||||
}
|
||||
for _, deleteFile := range deletedFiles {
|
||||
// Using RemoveAll as deletedFiles, which is generated from 'podman diff'
|
||||
// lists completely deleted directories as a single entry: 'D /root'.
|
||||
err = os.RemoveAll(filepath.Join(c.state.Mountpoint, deleteFile))
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to delete file %s from container %s during restore", deletedFilesPath, c.ID())
|
||||
return errors.Wrapf(err, "failed to delete file %s from container %s during restore", deletedFilesPath, c.ID())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -867,7 +867,7 @@ func (i *Image) PushImageToReference(ctx context.Context, dest types.ImageRefere
|
||||
// Copy the image to the remote destination
|
||||
manifestBytes, err := cp.Image(ctx, policyContext, dest, src, copyOptions)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Error copying image to the remote destination")
|
||||
return errors.Wrapf(err, "error copying image to the remote destination")
|
||||
}
|
||||
digest, err := manifest.Digest(manifestBytes)
|
||||
if err != nil {
|
||||
|
||||
@@ -1390,12 +1390,12 @@ func startCommandGivenSelinux(cmd *exec.Cmd) error {
|
||||
)
|
||||
plabel, err = selinux.CurrentLabel()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to get current SELinux label")
|
||||
return errors.Wrapf(err, "failed to get current SELinux label")
|
||||
}
|
||||
|
||||
con, err = selinux.NewContext(plabel)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "Failed to get new context from SELinux label")
|
||||
return errors.Wrapf(err, "failed to get new context from SELinux label")
|
||||
}
|
||||
|
||||
runtime.LockOSThread()
|
||||
|
||||
+1
-1
@@ -582,7 +582,7 @@ func (r *Runtime) Shutdown(force bool) error {
|
||||
// attempt to shut it down
|
||||
if r.store != nil {
|
||||
if _, err := r.store.Shutdown(force); err != nil {
|
||||
lastError = errors.Wrapf(err, "Error shutting down container storage")
|
||||
lastError = errors.Wrapf(err, "error shutting down container storage")
|
||||
}
|
||||
}
|
||||
if err := r.state.Close(); err != nil {
|
||||
|
||||
@@ -620,7 +620,7 @@ func (r *Runtime) evictContainer(ctx context.Context, idOrName string, removeVol
|
||||
|
||||
id, err := r.state.LookupContainerID(idOrName)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "Failed to find container %q in state", idOrName)
|
||||
return "", errors.Wrapf(err, "failed to find container %q in state", idOrName)
|
||||
}
|
||||
|
||||
// Begin by trying a normal removal. Valid containers will be removed normally.
|
||||
@@ -650,7 +650,7 @@ func (r *Runtime) evictContainer(ctx context.Context, idOrName string, removeVol
|
||||
return id, err
|
||||
}
|
||||
if !exists {
|
||||
return id, errors.Wrapf(err, "Failed to find container ID %q for eviction", id)
|
||||
return id, errors.Wrapf(err, "failed to find container ID %q for eviction", id)
|
||||
}
|
||||
|
||||
// Re-create a container struct for removal purposes
|
||||
|
||||
@@ -32,7 +32,7 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ func RemoveContainer(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
}
|
||||
logrus.Warn(errors.Wrapf(err, "Failed to evict container: %q", name))
|
||||
logrus.Warn(errors.Wrapf(err, "failed to evict container: %q", name))
|
||||
utils.InternalServerError(w, err)
|
||||
return
|
||||
}
|
||||
@@ -91,7 +91,7 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
if query.All {
|
||||
@@ -132,7 +132,7 @@ func GetContainer(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ func KillContainer(w http.ResponseWriter, r *http.Request) {
|
||||
Signal: "KILL",
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&input); err != nil {
|
||||
|
||||
@@ -35,7 +35,7 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) {
|
||||
Tail: "all",
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
logChannel := make(chan *logs.LogLine, tail+1)
|
||||
if err := runtime.Log(r.Context(), []*libpod.Container{ctnr}, options, logChannel); err != nil {
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "Failed to obtain logs for Container '%s'", name))
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "failed to obtain logs for Container '%s'", name))
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
@@ -111,7 +111,7 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) {
|
||||
if !utils.IsLibpodRequest(r) {
|
||||
inspectData, err := ctnr.Inspect(false)
|
||||
if err != nil {
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "Failed to obtain logs for Container '%s'", name))
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "failed to obtain logs for Container '%s'", name))
|
||||
return
|
||||
}
|
||||
writeHeader = !inspectData.Config.Tty
|
||||
|
||||
@@ -25,7 +25,7 @@ func PruneContainers(w http.ResponseWriter, r *http.Request) {
|
||||
Filters map[string][]string `schema:"filters"`
|
||||
}{}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
for k, v := range query.Filters {
|
||||
|
||||
@@ -19,7 +19,7 @@ func RestartContainer(w http.ResponseWriter, r *http.Request) {
|
||||
// Override golang default values for types
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.BadRequest(w, "url", r.URL.String(), errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.BadRequest(w, "url", r.URL.String(), errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ func StatsContainer(w http.ResponseWriter, r *http.Request) {
|
||||
Stream: true,
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func StatsContainer(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
stats, err := ctnr.GetContainerStats(&define.ContainerStats{})
|
||||
if err != nil {
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "Failed to obtain Container %s stats", name))
|
||||
utils.InternalServerError(w, errors.Wrapf(err, "failed to obtain Container %s stats", name))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ func StopContainer(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ func TopContainer(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ func GetEvents(w http.ResponseWriter, r *http.Request) {
|
||||
Stream: true,
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Failed to parse parameters", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "failed to parse parameters", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func GetEvents(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
libpodFilters, err := filtersFromRequest(r)
|
||||
if err != nil {
|
||||
utils.Error(w, "Failed to parse parameters", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "failed to parse parameters", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ func ExportImage(w http.ResponseWriter, r *http.Request) {
|
||||
name := utils.GetName(r)
|
||||
newImage, err := runtime.ImageRuntime().NewFromLocal(name)
|
||||
if err != nil {
|
||||
utils.ImageNotFound(w, name, errors.Wrapf(err, "Failed to find image %s", name))
|
||||
utils.ImageNotFound(w, name, errors.Wrapf(err, "failed to find image %s", name))
|
||||
return
|
||||
}
|
||||
tmpfile, err := ioutil.TempFile("", "api.tar")
|
||||
@@ -88,7 +88,7 @@ func PruneImages(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
rtc, err := runtime.GetConfig()
|
||||
@@ -205,7 +205,7 @@ func CreateImageFromSrc(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
// fromSrc – Source to import. The value may be a URL from which the image can be retrieved or - to read the image from the request body. This parameter may only be used when importing an image.
|
||||
@@ -264,7 +264,7 @@ func CreateImageFromImage(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ func CreateImageFromImage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
authConf, authfile, key, err := auth.GetCredentials(r)
|
||||
if err != nil {
|
||||
utils.Error(w, "Failed to retrieve repository credentials", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse %q header for %s", key, r.URL.String()))
|
||||
utils.Error(w, "failed to retrieve repository credentials", http.StatusBadRequest, errors.Wrapf(err, "failed to parse %q header for %s", key, r.URL.String()))
|
||||
return
|
||||
}
|
||||
defer auth.RemoveAuthfile(authfile)
|
||||
@@ -327,12 +327,12 @@ func GetImage(w http.ResponseWriter, r *http.Request) {
|
||||
name := utils.GetName(r)
|
||||
newImage, err := utils.GetImage(r, name)
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "Failed to find image %s", name))
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "failed to find image %s", name))
|
||||
return
|
||||
}
|
||||
inspect, err := handlers.ImageDataToImageInspect(r.Context(), newImage)
|
||||
if err != nil {
|
||||
utils.Error(w, "Server error", http.StatusInternalServerError, errors.Wrapf(err, "Failed to convert ImageData to ImageInspect '%s'", inspect.ID))
|
||||
utils.Error(w, "Server error", http.StatusInternalServerError, errors.Wrapf(err, "failed to convert ImageData to ImageInspect '%s'", inspect.ID))
|
||||
return
|
||||
}
|
||||
utils.WriteResponse(w, http.StatusOK, inspect)
|
||||
@@ -370,7 +370,7 @@ func LoadImages(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ func HistoryImage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
newImage, err := runtime.ImageRuntime().NewFromLocal(name)
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "Failed to find image %s", name))
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "failed to find image %s", name))
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
newImage, err := runtime.ImageRuntime().NewFromLocal(imageName)
|
||||
if err != nil {
|
||||
utils.ImageNotFound(w, imageName, errors.Wrapf(err, "Failed to find image %s", imageName))
|
||||
utils.ImageNotFound(w, imageName, errors.Wrapf(err, "failed to find image %s", imageName))
|
||||
return
|
||||
}
|
||||
|
||||
authConf, authfile, key, err := auth.GetCredentials(r)
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse %q header for %s", key, r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse %q header for %s", key, r.URL.String()))
|
||||
return
|
||||
}
|
||||
defer auth.RemoveAuthfile(authfile)
|
||||
@@ -76,7 +76,7 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||
nil, // additional tags
|
||||
)
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Error pushing image %q", imageName))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "error pushing image %q", imageName))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ func RemoveImage(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
if _, found := r.URL.Query()["noprune"]; found {
|
||||
@@ -32,7 +32,7 @@ func RemoveImage(w http.ResponseWriter, r *http.Request) {
|
||||
name := utils.GetName(r)
|
||||
newImage, err := runtime.ImageRuntime().NewFromLocal(name)
|
||||
if err != nil {
|
||||
utils.ImageNotFound(w, name, errors.Wrapf(err, "Failed to find image %s", name))
|
||||
utils.ImageNotFound(w, name, errors.Wrapf(err, "failed to find image %s", name))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ func SearchImages(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ func TagImage(w http.ResponseWriter, r *http.Request) {
|
||||
name := utils.GetName(r)
|
||||
newImage, err := runtime.ImageRuntime().NewFromLocal(name)
|
||||
if err != nil {
|
||||
utils.ImageNotFound(w, name, errors.Wrapf(err, "Failed to find image %s", name))
|
||||
utils.ImageNotFound(w, name, errors.Wrapf(err, "failed to find image %s", name))
|
||||
return
|
||||
}
|
||||
tag := "latest"
|
||||
|
||||
@@ -30,18 +30,18 @@ func GetInfo(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
infoData, err := runtime.Info()
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "Failed to obtain system memory info"))
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to obtain system memory info"))
|
||||
return
|
||||
}
|
||||
|
||||
configInfo, err := runtime.GetConfig()
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "Failed to obtain runtime config"))
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to obtain runtime config"))
|
||||
return
|
||||
}
|
||||
versionInfo, err := define.GetVersion()
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "Failed to obtain podman versions"))
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to obtain podman versions"))
|
||||
return
|
||||
}
|
||||
stateInfo := getContainersState(runtime)
|
||||
|
||||
@@ -35,7 +35,7 @@ func InspectNetwork(w http.ResponseWriter, r *http.Request) {
|
||||
//}
|
||||
//decoder := r.Context().Value("decoder").(*schema.Decoder)
|
||||
//if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
// utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
// utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
// return
|
||||
//}
|
||||
config, err := runtime.GetConfig()
|
||||
@@ -170,7 +170,7 @@ func ListNetworks(w http.ResponseWriter, r *http.Request) {
|
||||
// override any golang type defaults
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
config, err := runtime.GetConfig()
|
||||
|
||||
@@ -28,7 +28,7 @@ func ResizeTTY(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
infoData, err := runtime.Info()
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "Failed to obtain system memory info"))
|
||||
utils.Error(w, "Something went wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to obtain system memory info"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ func ListVolumes(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) {
|
||||
query := struct{}{}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
// decode params from body
|
||||
@@ -196,7 +196,7 @@ func RemoveVolume(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ func PruneVolumes(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
// TODO: We have no ability to pass pruning filters to `PruneVolumes()` so
|
||||
|
||||
@@ -49,7 +49,7 @@ func ListContainers(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ func GetContainer(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
runtime := r.Context().Value("runtime").(*libpod.Runtime)
|
||||
@@ -188,7 +188,7 @@ func Checkpoint(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
name := utils.GetName(r)
|
||||
@@ -256,7 +256,7 @@ func Restore(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
name := utils.GetName(r)
|
||||
|
||||
@@ -27,7 +27,7 @@ func StatsContainer(w http.ResponseWriter, r *http.Request) {
|
||||
Stream: true,
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ func ImageExists(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
_, err := runtime.ImageRuntime().NewFromLocal(name)
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "Failed to find image %s", name))
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "failed to find image %s", name))
|
||||
return
|
||||
}
|
||||
utils.WriteResponse(w, http.StatusNoContent, "")
|
||||
@@ -71,7 +71,7 @@ func ImageTree(w http.ResponseWriter, r *http.Request) {
|
||||
report, err := ir.Tree(r.Context(), name, options)
|
||||
if err != nil {
|
||||
if errors.Cause(err) == define.ErrNoSuchImage {
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "Failed to find image %s", name))
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "failed to find image %s", name))
|
||||
return
|
||||
}
|
||||
utils.Error(w, "Server error", http.StatusInternalServerError, errors.Wrapf(err, "failed to generate image tree for %s", name))
|
||||
@@ -84,7 +84,7 @@ func GetImage(w http.ResponseWriter, r *http.Request) {
|
||||
name := utils.GetName(r)
|
||||
newImage, err := utils.GetImage(r, name)
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "Failed to find image %s", name))
|
||||
utils.Error(w, "Something went wrong.", http.StatusNotFound, errors.Wrapf(err, "failed to find image %s", name))
|
||||
return
|
||||
}
|
||||
inspect, err := newImage.Inspect(r.Context())
|
||||
@@ -130,7 +130,7 @@ func PruneImages(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ func ExportImage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
name := utils.GetName(r)
|
||||
@@ -247,7 +247,7 @@ func ExportImages(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -434,13 +434,13 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
newImage, err := runtime.ImageRuntime().NewFromLocal(source)
|
||||
if err != nil {
|
||||
utils.ImageNotFound(w, source, errors.Wrapf(err, "Failed to find image %s", source))
|
||||
utils.ImageNotFound(w, source, errors.Wrapf(err, "failed to find image %s", source))
|
||||
return
|
||||
}
|
||||
|
||||
authConf, authfile, key, err := auth.GetCredentials(r)
|
||||
if err != nil {
|
||||
utils.Error(w, "Failed to retrieve repository credentials", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse %q header for %s", key, r.URL.String()))
|
||||
utils.Error(w, "failed to retrieve repository credentials", http.StatusBadRequest, errors.Wrapf(err, "failed to parse %q header for %s", key, r.URL.String()))
|
||||
return
|
||||
}
|
||||
defer auth.RemoveAuthfile(authfile)
|
||||
@@ -471,7 +471,7 @@ func PushImage(w http.ResponseWriter, r *http.Request) {
|
||||
nil, // additional tags
|
||||
)
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Error pushing image %q", destination))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "error pushing image %q", destination))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -500,7 +500,7 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
rtc, err := runtime.GetConfig()
|
||||
@@ -591,7 +591,7 @@ func UntagImage(w http.ResponseWriter, r *http.Request) {
|
||||
name := utils.GetName(r)
|
||||
if err := imageEngine.Untag(r.Context(), name, tags, opts); err != nil {
|
||||
if errors.Cause(err) == define.ErrNoSuchImage {
|
||||
utils.ImageNotFound(w, name, errors.Wrapf(err, "Failed to find image %s", name))
|
||||
utils.ImageNotFound(w, name, errors.Wrapf(err, "failed to find image %s", name))
|
||||
} else {
|
||||
utils.Error(w, "failed to untag", http.StatusInternalServerError, err)
|
||||
}
|
||||
@@ -613,7 +613,7 @@ func SearchImages(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ func SearchImages(w http.ResponseWriter, r *http.Request) {
|
||||
if _, found := r.URL.Query()["filters"]; found {
|
||||
filter, err := image.ParseSearchFilter(query.Filters)
|
||||
if err != nil {
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse filters parameter for %s", r.URL.String()))
|
||||
utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse filters parameter for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
options.Filter = *filter
|
||||
|
||||
@@ -76,7 +76,7 @@ func ImagesPull(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
authConf, authfile, key, err := auth.GetCredentials(r)
|
||||
if err != nil {
|
||||
utils.Error(w, "Failed to retrieve repository credentials", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse %q header for %s", key, r.URL.String()))
|
||||
utils.Error(w, "failed to retrieve repository credentials", http.StatusBadRequest, errors.Wrapf(err, "failed to parse %q header for %s", key, r.URL.String()))
|
||||
return
|
||||
}
|
||||
defer auth.RemoveAuthfile(authfile)
|
||||
|
||||
@@ -28,7 +28,7 @@ func CreateNetwork(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
ic := abi.ContainerEngine{Libpod: runtime}
|
||||
@@ -50,7 +50,7 @@ func ListNetworks(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ func RemoveNetwork(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
name := utils.GetName(r)
|
||||
@@ -109,7 +109,7 @@ func InspectNetwork(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
name := utils.GetName(r)
|
||||
|
||||
@@ -50,7 +50,7 @@ func PlayKube(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
authConf, authfile, key, err := auth.GetCredentials(r)
|
||||
if err != nil {
|
||||
utils.Error(w, "Failed to retrieve repository credentials", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse %q header for %s", key, r.URL.String()))
|
||||
utils.Error(w, "failed to retrieve repository credentials", http.StatusBadRequest, errors.Wrapf(err, "failed to parse %q header for %s", key, r.URL.String()))
|
||||
return
|
||||
}
|
||||
defer auth.RemoveAuthfile(authfile)
|
||||
|
||||
@@ -27,7 +27,7 @@ func PodCreate(w http.ResponseWriter, r *http.Request) {
|
||||
)
|
||||
var psg specgen.PodSpecGenerator
|
||||
if err := json.NewDecoder(r.Body).Decode(&psg); err != nil {
|
||||
utils.Error(w, "Failed to decode specgen", http.StatusInternalServerError, errors.Wrap(err, "failed to decode specgen"))
|
||||
utils.Error(w, "failed to decode specgen", http.StatusInternalServerError, errors.Wrap(err, "failed to decode specgen"))
|
||||
return
|
||||
}
|
||||
pod, err := generate.MakePod(&psg, runtime)
|
||||
@@ -51,7 +51,7 @@ func Pods(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func PodStop(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
name := utils.GetName(r)
|
||||
@@ -191,7 +191,7 @@ func PodDelete(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
name := utils.GetName(r)
|
||||
@@ -320,7 +320,7 @@ func PodTop(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ func PodKill(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
if _, found := r.URL.Query()["signal"]; found {
|
||||
@@ -443,7 +443,7 @@ func PodStats(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ func SystemPrune(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ func CreateVolume(w http.ResponseWriter, r *http.Request) {
|
||||
input := entities.VolumeCreateOptions{}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
// decode params from body
|
||||
@@ -124,7 +124,7 @@ func ListVolumes(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ func RemoveVolume(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
utils.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest,
|
||||
errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return
|
||||
}
|
||||
name := utils.GetName(r)
|
||||
|
||||
@@ -178,29 +178,29 @@ type ExecStartConfig struct {
|
||||
func ImageToImageSummary(l *libpodImage.Image) (*entities.ImageSummary, error) {
|
||||
containers, err := l.Containers()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Failed to obtain Containers for image %s", l.ID())
|
||||
return nil, errors.Wrapf(err, "failed to obtain Containers for image %s", l.ID())
|
||||
}
|
||||
containerCount := len(containers)
|
||||
|
||||
// FIXME: GetParent() panics
|
||||
// parent, err := l.GetParent(context.TODO())
|
||||
// if err != nil {
|
||||
// return nil, errors.Wrapf(err, "Failed to obtain ParentID for image %s", l.ID())
|
||||
// return nil, errors.Wrapf(err, "failed to obtain ParentID for image %s", l.ID())
|
||||
// }
|
||||
|
||||
labels, err := l.Labels(context.TODO())
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Failed to obtain Labels for image %s", l.ID())
|
||||
return nil, errors.Wrapf(err, "failed to obtain Labels for image %s", l.ID())
|
||||
}
|
||||
|
||||
size, err := l.Size(context.TODO())
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Failed to obtain Size for image %s", l.ID())
|
||||
return nil, errors.Wrapf(err, "failed to obtain Size for image %s", l.ID())
|
||||
}
|
||||
|
||||
repoTags, err := l.RepoTags()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Failed to obtain RepoTags for image %s", l.ID())
|
||||
return nil, errors.Wrapf(err, "failed to obtain RepoTags for image %s", l.ID())
|
||||
}
|
||||
|
||||
digests := make([]string, len(l.Digests()))
|
||||
|
||||
@@ -27,7 +27,7 @@ func WaitContainer(w http.ResponseWriter, r *http.Request) (int32, error) {
|
||||
// Override golang default values for types
|
||||
}
|
||||
if err := decoder.Decode(&query, r.URL.Query()); err != nil {
|
||||
Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String()))
|
||||
Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "failed to parse parameters for %s", r.URL.String()))
|
||||
return 0, err
|
||||
}
|
||||
if _, found := r.URL.Query()["interval"]; found {
|
||||
|
||||
@@ -90,7 +90,7 @@ func InternalServerError(w http.ResponseWriter, err error) {
|
||||
}
|
||||
|
||||
func BadRequest(w http.ResponseWriter, key string, value string, err error) {
|
||||
e := errors.Wrapf(err, "Failed to parse query parameter '%s': %q", key, value)
|
||||
e := errors.Wrapf(err, "failed to parse query parameter '%s': %q", key, value)
|
||||
Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest, e)
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ func NewConnectionWithIdentity(ctx context.Context, uri string, identity string)
|
||||
return nil, errors.Errorf("unable to create connection. %q is not a supported schema", _url.Scheme)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Failed to create %sClient", _url.Scheme)
|
||||
return nil, errors.Wrapf(err, "failed to create %sClient", _url.Scheme)
|
||||
}
|
||||
|
||||
ctx = context.WithValue(ctx, clientKey, &connection)
|
||||
|
||||
@@ -24,11 +24,11 @@ import (
|
||||
func crImportFromJSON(filePath string, v interface{}) error {
|
||||
content, err := ioutil.ReadFile(filePath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Failed to read container definition for restore")
|
||||
return errors.Wrap(err, "failed to read container definition for restore")
|
||||
}
|
||||
json := jsoniter.ConfigCompatibleWithStandardLibrary
|
||||
if err = json.Unmarshal(content, v); err != nil {
|
||||
return errors.Wrapf(err, "Failed to unmarshal container definition %s for restore", filePath)
|
||||
return errors.Wrapf(err, "failed to unmarshal container definition %s for restore", filePath)
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -41,7 +41,7 @@ func CRImportCheckpoint(ctx context.Context, runtime *libpod.Runtime, input stri
|
||||
// tarball to a temporary directory
|
||||
archiveFile, err := os.Open(input)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Failed to open checkpoint archive for import")
|
||||
return nil, errors.Wrap(err, "failed to open checkpoint archive for import")
|
||||
}
|
||||
defer errorhandling.CloseQuiet(archiveFile)
|
||||
options := &archive.TarOptions{
|
||||
|
||||
@@ -312,7 +312,7 @@ func (ic *ContainerEngine) ContainerRm(ctx context.Context, namesOrIds []string,
|
||||
reports = append(reports, &report)
|
||||
continue
|
||||
}
|
||||
report.Err = errors.Wrapf(err, "Failed to evict container: %q", id)
|
||||
report.Err = errors.Wrapf(err, "failed to evict container: %q", id)
|
||||
reports = append(reports, &report)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ func (ic *ContainerEngine) playKubeDeployment(ctx context.Context, deploymentYAM
|
||||
podName := fmt.Sprintf("%s-pod-%d", deploymentName, i)
|
||||
podReport, err := ic.playKubePod(ctx, podName, &podSpec, options)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Error encountered while bringing up pod %s", podName)
|
||||
return nil, errors.Wrapf(err, "error encountered while bringing up pod %s", podName)
|
||||
}
|
||||
report.Pods = append(report.Pods, podReport.Pods...)
|
||||
}
|
||||
@@ -248,18 +248,18 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
||||
case v1.HostPathDirectoryOrCreate:
|
||||
if _, err := os.Stat(hostPath.Path); os.IsNotExist(err) {
|
||||
if err := os.Mkdir(hostPath.Path, kubeDirectoryPermission); err != nil {
|
||||
return nil, errors.Errorf("Error creating HostPath %s", volume.Name)
|
||||
return nil, errors.Errorf("error creating HostPath %s", volume.Name)
|
||||
}
|
||||
}
|
||||
// Label a newly created volume
|
||||
if err := libpod.LabelVolumePath(hostPath.Path); err != nil {
|
||||
return nil, errors.Wrapf(err, "Error giving %s a label", hostPath.Path)
|
||||
return nil, errors.Wrapf(err, "error giving %s a label", hostPath.Path)
|
||||
}
|
||||
case v1.HostPathFileOrCreate:
|
||||
if _, err := os.Stat(hostPath.Path); os.IsNotExist(err) {
|
||||
f, err := os.OpenFile(hostPath.Path, os.O_RDONLY|os.O_CREATE, kubeFilePermission)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("Error creating HostPath %s", volume.Name)
|
||||
return nil, errors.Errorf("error creating HostPath %s", volume.Name)
|
||||
}
|
||||
if err := f.Close(); err != nil {
|
||||
logrus.Warnf("Error in closing newly created HostPath file: %v", err)
|
||||
@@ -267,15 +267,15 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
||||
}
|
||||
// unconditionally label a newly created volume
|
||||
if err := libpod.LabelVolumePath(hostPath.Path); err != nil {
|
||||
return nil, errors.Wrapf(err, "Error giving %s a label", hostPath.Path)
|
||||
return nil, errors.Wrapf(err, "error giving %s a label", hostPath.Path)
|
||||
}
|
||||
case v1.HostPathSocket:
|
||||
st, err := os.Stat(hostPath.Path)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Error checking HostPathSocket")
|
||||
return nil, errors.Wrap(err, "error checking HostPathSocket")
|
||||
}
|
||||
if st.Mode()&os.ModeSocket != os.ModeSocket {
|
||||
return nil, errors.Errorf("Error checking HostPathSocket: path %s is not a socket", hostPath.Path)
|
||||
return nil, errors.Errorf("error checking HostPathSocket: path %s is not a socket", hostPath.Path)
|
||||
}
|
||||
|
||||
case v1.HostPathDirectory:
|
||||
@@ -289,7 +289,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
|
||||
}
|
||||
|
||||
if err := parse.ValidateVolumeHostDir(hostPath.Path); err != nil {
|
||||
return nil, errors.Wrapf(err, "Error in parsing HostPath in YAML")
|
||||
return nil, errors.Wrapf(err, "error in parsing HostPath in YAML")
|
||||
}
|
||||
volumes[volume.Name] = hostPath.Path
|
||||
}
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ func LoadAndMergeConfig(dirPath string) (*RegistryConfiguration, error) {
|
||||
var config RegistryConfiguration
|
||||
err = yaml.Unmarshal(configBytes, &config)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "Error parsing %s", configPath)
|
||||
return nil, errors.Wrapf(err, "error parsing %s", configPath)
|
||||
}
|
||||
if config.DefaultDocker != nil {
|
||||
if mergedConfig.DefaultDocker != nil {
|
||||
|
||||
Reference in new issue
Block a user