summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/Makefile3
-rw-r--r--pkg/api/handlers/compat/images_build.go12
-rw-r--r--pkg/api/handlers/compat/volumes.go2
-rw-r--r--pkg/api/handlers/libpod/swagger.go2
-rw-r--r--pkg/api/handlers/libpod/system.go1
-rw-r--r--pkg/api/handlers/libpod/volumes.go2
-rw-r--r--pkg/api/server/register_containers.go13
-rw-r--r--pkg/api/server/register_generate.go4
-rw-r--r--pkg/api/server/register_healthcheck.go4
-rw-r--r--pkg/api/server/register_images.go60
-rw-r--r--pkg/api/server/register_manifest.go13
-rw-r--r--pkg/bindings/images/build.go5
-rw-r--r--pkg/cgroups/cgroups.go2
-rw-r--r--pkg/cgroups/cpu.go8
-rw-r--r--pkg/domain/filters/volumes.go20
15 files changed, 101 insertions, 50 deletions
diff --git a/pkg/api/Makefile b/pkg/api/Makefile
index 6b24bfd83..6da5fb57e 100644
--- a/pkg/api/Makefile
+++ b/pkg/api/Makefile
@@ -5,6 +5,9 @@ SWAGGER_OUT ?= swagger.yaml
validate: ${SWAGGER_OUT}
swagger validate ${SWAGGER_OUT}
+serve: ${SWAGGER_OUT}
+ swagger serve -F redoc -p=8080 swagger.yaml
+
.PHONY: ${SWAGGER_OUT}
${SWAGGER_OUT}:
# generate doesn't remove file on error
diff --git a/pkg/api/handlers/compat/images_build.go b/pkg/api/handlers/compat/images_build.go
index ab92434b1..700881926 100644
--- a/pkg/api/handlers/compat/images_build.go
+++ b/pkg/api/handlers/compat/images_build.go
@@ -15,6 +15,7 @@ import (
"github.com/containers/buildah"
buildahDefine "github.com/containers/buildah/define"
+ "github.com/containers/buildah/pkg/parse"
"github.com/containers/buildah/util"
"github.com/containers/image/v5/types"
"github.com/containers/podman/v3/libpod"
@@ -445,6 +446,17 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
},
}
+ if len(query.Platform) > 0 {
+ variant := ""
+ buildOptions.OS, buildOptions.Architecture, variant, err = parse.Platform(query.Platform)
+ if err != nil {
+ utils.BadRequest(w, "platform", query.Platform, err)
+ return
+ }
+ buildOptions.SystemContext.OSChoice = buildOptions.OS
+ buildOptions.SystemContext.ArchitectureChoice = buildOptions.Architecture
+ buildOptions.SystemContext.VariantChoice = variant
+ }
if _, found := r.URL.Query()["timestamp"]; found {
ts := time.Unix(query.Timestamp, 0)
buildOptions.Timestamp = &ts
diff --git a/pkg/api/handlers/compat/volumes.go b/pkg/api/handlers/compat/volumes.go
index 42ece643b..d86fc1e19 100644
--- a/pkg/api/handlers/compat/volumes.go
+++ b/pkg/api/handlers/compat/volumes.go
@@ -266,7 +266,7 @@ func PruneVolumes(w http.ResponseWriter, r *http.Request) {
}
f := (url.Values)(*filterMap)
- filterFuncs, err := filters.GenerateVolumeFilters(f)
+ filterFuncs, err := filters.GeneratePruneVolumeFilters(f)
if err != nil {
utils.Error(w, "Something when wrong.", http.StatusInternalServerError, errors.Wrapf(err, "failed to parse filters for %s", f.Encode()))
return
diff --git a/pkg/api/handlers/libpod/swagger.go b/pkg/api/handlers/libpod/swagger.go
index 2631f19ac..9450a70d9 100644
--- a/pkg/api/handlers/libpod/swagger.go
+++ b/pkg/api/handlers/libpod/swagger.go
@@ -25,7 +25,7 @@ type swagInspectPodResponse struct {
// swagger:response InspectManifest
type swagInspectManifestResponse struct {
// in:body
- Body manifest.List
+ Body manifest.Schema2List
}
// Kill Pod
diff --git a/pkg/api/handlers/libpod/system.go b/pkg/api/handlers/libpod/system.go
index 02457eb8f..2b4cef1bb 100644
--- a/pkg/api/handlers/libpod/system.go
+++ b/pkg/api/handlers/libpod/system.go
@@ -72,6 +72,7 @@ func DiskUsage(w http.ResponseWriter, r *http.Request) {
response, err := ic.SystemDf(r.Context(), options)
if err != nil {
utils.InternalServerError(w, err)
+ return
}
utils.WriteResponse(w, http.StatusOK, response)
}
diff --git a/pkg/api/handlers/libpod/volumes.go b/pkg/api/handlers/libpod/volumes.go
index 442b53d1e..68aec30d5 100644
--- a/pkg/api/handlers/libpod/volumes.go
+++ b/pkg/api/handlers/libpod/volumes.go
@@ -150,7 +150,7 @@ func pruneVolumesHelper(r *http.Request) ([]*reports.PruneReport, error) {
}
f := (url.Values)(*filterMap)
- filterFuncs, err := filters.GenerateVolumeFilters(f)
+ filterFuncs, err := filters.GeneratePruneVolumeFilters(f)
if err != nil {
return nil, err
}
diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go
index c2bb44c8f..536c4707a 100644
--- a/pkg/api/server/register_containers.go
+++ b/pkg/api/server/register_containers.go
@@ -1194,11 +1194,22 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// - removing
// - stopping
// description: "Conditions to wait for. If no condition provided the 'exited' condition is assumed."
+ // - in: query
+ // name: interval
+ // type: string
+ // default: "250ms"
+ // description: Time Interval to wait before polling for completion.
// produces:
// - application/json
+ // - text/plain
// responses:
// 200:
- // $ref: "#/responses/ContainerWaitResponse"
+ // description: Status code
+ // schema:
+ // type: integer
+ // format: int32
+ // examples:
+ // text/plain: 137
// 404:
// $ref: "#/responses/NoSuchContainer"
// 500:
diff --git a/pkg/api/server/register_generate.go b/pkg/api/server/register_generate.go
index 208bf668c..e10c7029c 100644
--- a/pkg/api/server/register_generate.go
+++ b/pkg/api/server/register_generate.go
@@ -8,7 +8,7 @@ import (
)
func (s *APIServer) registerGenerateHandlers(r *mux.Router) error {
- // swagger:operation GET /libpod/generate/{name:.*}/systemd libpod GenerateSystemdLibpod
+ // swagger:operation GET /libpod/generate/{name}/systemd libpod GenerateSystemdLibpod
// ---
// tags:
// - containers
@@ -17,7 +17,7 @@ func (s *APIServer) registerGenerateHandlers(r *mux.Router) error {
// description: Generate Systemd Units based on a pod or container.
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: Name or ID of the container or pod.
diff --git a/pkg/api/server/register_healthcheck.go b/pkg/api/server/register_healthcheck.go
index e2fd5ac68..7d8541a51 100644
--- a/pkg/api/server/register_healthcheck.go
+++ b/pkg/api/server/register_healthcheck.go
@@ -8,7 +8,7 @@ import (
)
func (s *APIServer) registerHealthCheckHandlers(r *mux.Router) error {
- // swagger:operation GET /libpod/containers/{name:.*}/healthcheck libpod ContainerHealthcheckLibpod
+ // swagger:operation GET /libpod/containers/{name}/healthcheck libpod ContainerHealthcheckLibpod
// ---
// tags:
// - containers
@@ -16,7 +16,7 @@ func (s *APIServer) registerHealthCheckHandlers(r *mux.Router) error {
// description: Execute the defined healthcheck and return information about the results
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
diff --git a/pkg/api/server/register_images.go b/pkg/api/server/register_images.go
index de8d50cc9..b32c0df20 100644
--- a/pkg/api/server/register_images.go
+++ b/pkg/api/server/register_images.go
@@ -188,7 +188,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/images/search"), s.APIHandler(compat.SearchImages)).Methods(http.MethodGet)
// Added non version path to URI to support docker non versioned paths
r.Handle("/images/search", s.APIHandler(compat.SearchImages)).Methods(http.MethodGet)
- // swagger:operation DELETE /images/{name:.*} compat ImageDelete
+ // swagger:operation DELETE /images/{name} compat ImageDelete
// ---
// tags:
// - images (compat)
@@ -196,7 +196,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Delete an image from local storage
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: name or ID of image to delete
@@ -222,7 +222,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/images/{name:.*}"), s.APIHandler(compat.RemoveImage)).Methods(http.MethodDelete)
// Added non version path to URI to support docker non versioned paths
r.Handle("/images/{name:.*}", s.APIHandler(compat.RemoveImage)).Methods(http.MethodDelete)
- // swagger:operation POST /images/{name:.*}/push compat ImagePush
+ // swagger:operation POST /images/{name}/push compat ImagePush
// ---
// tags:
// - images (compat)
@@ -230,7 +230,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Push an image to a container registry
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: Name of image to push.
@@ -269,7 +269,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/images/{name:.*}/push"), s.APIHandler(compat.PushImage)).Methods(http.MethodPost)
// Added non version path to URI to support docker non versioned paths
r.Handle("/images/{name:.*}/push", s.APIHandler(compat.PushImage)).Methods(http.MethodPost)
- // swagger:operation GET /images/{name:.*}/get compat ImageGet
+ // swagger:operation GET /images/{name}/get compat ImageGet
// ---
// tags:
// - images (compat)
@@ -277,7 +277,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Export an image in tarball format
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -319,7 +319,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/images/get"), s.APIHandler(compat.ExportImages)).Methods(http.MethodGet)
// Added non version path to URI to support docker non versioned paths
r.Handle("/images/get", s.APIHandler(compat.ExportImages)).Methods(http.MethodGet)
- // swagger:operation GET /images/{name:.*}/history compat ImageHistory
+ // swagger:operation GET /images/{name}/history compat ImageHistory
// ---
// tags:
// - images (compat)
@@ -327,7 +327,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Return parent layers of an image.
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -343,7 +343,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/images/{name:.*}/history"), s.APIHandler(compat.HistoryImage)).Methods(http.MethodGet)
// Added non version path to URI to support docker non versioned paths
r.Handle("/images/{name:.*}/history", s.APIHandler(compat.HistoryImage)).Methods(http.MethodGet)
- // swagger:operation GET /images/{name:.*}/json compat ImageInspect
+ // swagger:operation GET /images/{name}/json compat ImageInspect
// ---
// tags:
// - images (compat)
@@ -351,7 +351,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Return low-level information about an image.
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -367,7 +367,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
r.Handle(VersionedPath("/images/{name:.*}/json"), s.APIHandler(compat.GetImage)).Methods(http.MethodGet)
// Added non version path to URI to support docker non versioned paths
r.Handle("/images/{name:.*}/json", s.APIHandler(compat.GetImage)).Methods(http.MethodGet)
- // swagger:operation POST /images/{name:.*}/tag compat ImageTag
+ // swagger:operation POST /images/{name}/tag compat ImageTag
// ---
// tags:
// - images (compat)
@@ -375,7 +375,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Tag an image so that it becomes part of a repository.
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -667,7 +667,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
libpod endpoints
*/
- // swagger:operation POST /libpod/images/{name:.*}/push libpod ImagePushLibpod
+ // swagger:operation POST /libpod/images/{name}/push libpod ImagePushLibpod
// ---
// tags:
// - images
@@ -675,7 +675,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Push an image to a container registry
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: Name of image to push.
@@ -705,7 +705,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/{name:.*}/push"), s.APIHandler(libpod.PushImage)).Methods(http.MethodPost)
- // swagger:operation GET /libpod/images/{name:.*}/exists libpod ImageExistsLibpod
+ // swagger:operation GET /libpod/images/{name}/exists libpod ImageExistsLibpod
// ---
// tags:
// - images
@@ -713,7 +713,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Check if image exists in local store
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -727,7 +727,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/{name:.*}/exists"), s.APIHandler(libpod.ImageExists)).Methods(http.MethodGet)
- // swagger:operation GET /libpod/images/{name:.*}/tree libpod ImageTreeLibpod
+ // swagger:operation GET /libpod/images/{name}/tree libpod ImageTreeLibpod
// ---
// tags:
// - images
@@ -735,7 +735,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Retrieve the image tree for the provided image name or ID
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -753,7 +753,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/{name:.*}/tree"), s.APIHandler(libpod.ImageTree)).Methods(http.MethodGet)
- // swagger:operation GET /libpod/images/{name:.*}/history libpod ImageHistoryLibpod
+ // swagger:operation GET /libpod/images/{name}/history libpod ImageHistoryLibpod
// ---
// tags:
// - images
@@ -761,7 +761,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Return parent layers of an image.
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -906,7 +906,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/remove"), s.APIHandler(libpod.ImagesBatchRemove)).Methods(http.MethodDelete)
- // swagger:operation DELETE /libpod/images/{name:.*} libpod ImageDeleteLibpod
+ // swagger:operation DELETE /libpod/images/{name} libpod ImageDeleteLibpod
// ---
// tags:
// - images
@@ -914,7 +914,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Remove an image from the local storage.
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: name or ID of image to remove
@@ -1042,7 +1042,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/search"), s.APIHandler(compat.SearchImages)).Methods(http.MethodGet)
- // swagger:operation GET /libpod/images/{name:.*}/get libpod ImageGetLibpod
+ // swagger:operation GET /libpod/images/{name}/get libpod ImageGetLibpod
// ---
// tags:
// - images
@@ -1050,7 +1050,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Export an image
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -1109,7 +1109,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/export"), s.APIHandler(libpod.ExportImages)).Methods(http.MethodGet)
- // swagger:operation GET /libpod/images/{name:.*}/json libpod ImageInspectLibpod
+ // swagger:operation GET /libpod/images/{name}/json libpod ImageInspectLibpod
// ---
// tags:
// - images
@@ -1117,7 +1117,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Obtain low-level information about an image
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -1131,7 +1131,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/images/{name:.*}/json"), s.APIHandler(libpod.GetImage)).Methods(http.MethodGet)
- // swagger:operation POST /libpod/images/{name:.*}/tag libpod ImageTagLibpod
+ // swagger:operation POST /libpod/images/{name}/tag libpod ImageTagLibpod
// ---
// tags:
// - images
@@ -1139,7 +1139,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Tag an image so that it becomes part of a repository.
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
@@ -1217,7 +1217,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/commit"), s.APIHandler(libpod.CommitContainer)).Methods(http.MethodPost)
- // swagger:operation POST /libpod/images/{name:.*}/untag libpod ImageUntagLibpod
+ // swagger:operation POST /libpod/images/{name}/untag libpod ImageUntagLibpod
// ---
// tags:
// - images
@@ -1225,7 +1225,7 @@ func (s *APIServer) registerImagesHandlers(r *mux.Router) error {
// description: Untag an image. If not repo and tag are specified, all tags are removed from the image.
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the container
diff --git a/pkg/api/server/register_manifest.go b/pkg/api/server/register_manifest.go
index 0417462a6..010d8a79e 100644
--- a/pkg/api/server/register_manifest.go
+++ b/pkg/api/server/register_manifest.go
@@ -59,7 +59,7 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// 500:
// $ref: '#/responses/InternalError'
r.Handle(VersionedPath("/libpod/manifests/{name}/exists"), s.APIHandler(libpod.ExistsManifest)).Methods(http.MethodGet)
- // swagger:operation GET /libpod/manifests/{name:.*}/json manifests ManifestInspectLibpod
+ // swagger:operation GET /libpod/manifests/{name}/json manifests ManifestInspectLibpod
// ---
// summary: Inspect
// description: Display a manifest list
@@ -67,7 +67,7 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// - application/json
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the manifest
@@ -79,14 +79,15 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/manifests/{name:.*}/json"), s.APIHandler(libpod.ManifestInspect)).Methods(http.MethodGet)
- // swagger:operation POST /libpod/manifests/{name:.*}/add manifests ManifestAddLibpod
+ // swagger:operation POST /libpod/manifests/{name}/add manifests ManifestAddLibpod
// ---
+ // summary: Add image
// description: Add an image to a manifest list
// produces:
// - application/json
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the name or ID of the manifest
@@ -106,7 +107,7 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// 500:
// $ref: "#/responses/InternalError"
r.Handle(VersionedPath("/libpod/manifests/{name:.*}/add"), s.APIHandler(libpod.ManifestAdd)).Methods(http.MethodPost)
- // swagger:operation DELETE /libpod/manifests/{name:.*} manifests ManifestDeleteLibpod
+ // swagger:operation DELETE /libpod/manifests/{name} manifests ManifestDeleteLibpod
// ---
// summary: Remove
// description: Remove an image from a manifest list
@@ -114,7 +115,7 @@ func (s *APIServer) registerManifestHandlers(r *mux.Router) error {
// - application/json
// parameters:
// - in: path
- // name: name:.*
+ // name: name
// type: string
// required: true
// description: the image associated with the manifest
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index c47a16551..34d6cee05 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -12,6 +12,7 @@ import (
"os"
"path/filepath"
"regexp"
+ "runtime"
"strconv"
"strings"
@@ -190,6 +191,10 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
platform = "linux"
}
platform += "/" + options.Architecture
+ } else {
+ if len(platform) > 0 {
+ platform += "/" + runtime.GOARCH
+ }
}
if len(platform) > 0 {
params.Set("platform", platform)
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index 608e1647a..aefb5183b 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -265,7 +265,7 @@ func readFileAsUint64(path string) (uint64, error) {
if v == "max" {
return math.MaxUint64, nil
}
- ret, err := strconv.ParseUint(v, 10, 0)
+ ret, err := strconv.ParseUint(v, 10, 64)
if err != nil {
return ret, errors.Wrapf(err, "parse %s from %s", v, path)
}
diff --git a/pkg/cgroups/cpu.go b/pkg/cgroups/cpu.go
index 05223c2e1..23539757d 100644
--- a/pkg/cgroups/cpu.go
+++ b/pkg/cgroups/cpu.go
@@ -40,7 +40,7 @@ func readAcctList(ctr *CgroupControl, name string) ([]uint64, error) {
if s == "" {
break
}
- v, err := strconv.ParseUint(s, 10, 0)
+ v, err := strconv.ParseUint(s, 10, 64)
if err != nil {
return nil, errors.Wrapf(err, "parsing %s", s)
}
@@ -80,14 +80,14 @@ func (c *cpuHandler) Stat(ctr *CgroupControl, m *Metrics) error {
return err
}
if val, found := values["usage_usec"]; found {
- usage.Total, err = strconv.ParseUint(cleanString(val[0]), 10, 0)
+ usage.Total, err = strconv.ParseUint(cleanString(val[0]), 10, 64)
if err != nil {
return err
}
usage.Kernel *= 1000
}
if val, found := values["system_usec"]; found {
- usage.Kernel, err = strconv.ParseUint(cleanString(val[0]), 10, 0)
+ usage.Kernel, err = strconv.ParseUint(cleanString(val[0]), 10, 64)
if err != nil {
return err
}
@@ -149,7 +149,7 @@ func GetSystemCPUUsage() (uint64, error) {
}
if val, found := values["usage_usec"]; found {
- v, err := strconv.ParseUint(cleanString(val[0]), 10, 0)
+ v, err := strconv.ParseUint(cleanString(val[0]), 10, 64)
if err != nil {
return 0, err
}
diff --git a/pkg/domain/filters/volumes.go b/pkg/domain/filters/volumes.go
index 9b2fc5280..9a08adf82 100644
--- a/pkg/domain/filters/volumes.go
+++ b/pkg/domain/filters/volumes.go
@@ -75,7 +75,25 @@ func GenerateVolumeFilters(filters url.Values) ([]libpod.VolumeFilter, error) {
return dangling
})
default:
- return nil, errors.Errorf("%q is in an invalid volume filter", filter)
+ return nil, errors.Errorf("%q is an invalid volume filter", filter)
+ }
+ }
+ }
+ return vf, nil
+}
+
+func GeneratePruneVolumeFilters(filters url.Values) ([]libpod.VolumeFilter, error) {
+ var vf []libpod.VolumeFilter
+ for filter, v := range filters {
+ for _, val := range v {
+ switch filter {
+ case "label":
+ filter := val
+ vf = append(vf, func(v *libpod.Volume) bool {
+ return util.MatchLabelFilters([]string{filter}, v.Labels())
+ })
+ default:
+ return nil, errors.Errorf("%q is an invalid volume filter", filter)
}
}
}