summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r--pkg/api/handlers/images.go2
-rw-r--r--pkg/api/handlers/types.go21
-rw-r--r--pkg/api/handlers/utils/images.go6
3 files changed, 18 insertions, 11 deletions
diff --git a/pkg/api/handlers/images.go b/pkg/api/handlers/images.go
index cd3c0b93f..e4e394d68 100644
--- a/pkg/api/handlers/images.go
+++ b/pkg/api/handlers/images.go
@@ -155,7 +155,7 @@ func SearchImages(w http.ResponseWriter, r *http.Request) {
}
results, err := image.SearchImages(query.Term, options)
if err != nil {
- utils.InternalServerError(w, err)
+ utils.BadRequest(w, "term", query.Term, err)
}
utils.WriteResponse(w, http.StatusOK, results)
}
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index f5d9f9ad5..a50f183f7 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -351,18 +351,21 @@ func ImageDataToImageInspect(ctx context.Context, l *libpodImage.Image) (*ImageI
func LibpodToContainer(l *libpod.Container, infoData []define.InfoData) (*Container, error) {
imageId, imageName := l.Image()
- sizeRW, err := l.RWSize()
- if err != nil {
+
+ var (
+ err error
+ sizeRootFs int64
+ sizeRW int64
+ state define.ContainerStatus
+ )
+
+ if state, err = l.State(); err != nil {
return nil, err
}
-
- SizeRootFs, err := l.RootFsSize()
- if err != nil {
+ if sizeRW, err = l.RWSize(); err != nil {
return nil, err
}
-
- state, err := l.State()
- if err != nil {
+ if sizeRootFs, err = l.RootFsSize(); err != nil {
return nil, err
}
@@ -375,7 +378,7 @@ func LibpodToContainer(l *libpod.Container, infoData []define.InfoData) (*Contai
Created: l.CreatedTime().Unix(),
Ports: nil,
SizeRw: sizeRW,
- SizeRootFs: SizeRootFs,
+ SizeRootFs: sizeRootFs,
Labels: l.Labels(),
State: string(state),
Status: "",
diff --git a/pkg/api/handlers/utils/images.go b/pkg/api/handlers/utils/images.go
index d0dfbf3ab..f68a71561 100644
--- a/pkg/api/handlers/utils/images.go
+++ b/pkg/api/handlers/utils/images.go
@@ -31,12 +31,16 @@ func GetImages(w http.ResponseWriter, r *http.Request) ([]*image.Image, error) {
if _, found := mux.Vars(r)["digests"]; found && query.Digests {
UnSupportedParameter("digests")
}
+
if len(query.Filters) > 0 {
for k, v := range query.Filters {
for _, val := range v {
filters = append(filters, fmt.Sprintf("%s=%s", k, val))
}
}
+ return runtime.ImageRuntime().GetImagesWithFilters(filters)
+ } else {
+ return runtime.ImageRuntime().GetImages()
}
- return runtime.ImageRuntime().GetImagesWithFilters(filters)
+
}