aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpod/runtime.go12
-rw-r--r--pkg/api/handlers/swagger/swagger.go9
-rw-r--r--pkg/api/server/register_containers.go4
3 files changed, 20 insertions, 5 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 1c9c56d16..761fa08a2 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -335,8 +335,16 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
// If user is rootless and XDG_RUNTIME_DIR is found, podman will not proceed with /tmp directory
// it will try to use existing XDG_RUNTIME_DIR
// if current user has no write access to XDG_RUNTIME_DIR we will fail later
- if unix.Access(runtime.storageConfig.RunRoot, unix.W_OK) != nil {
- logrus.Warnf("XDG_RUNTIME_DIR is pointing to a path which is not writable. Most likely podman will fail.")
+ if err := unix.Access(runtime.storageConfig.RunRoot, unix.W_OK); err != nil {
+ msg := "XDG_RUNTIME_DIR is pointing to a path which is not writable. Most likely podman will fail."
+ if errors.Is(err, os.ErrNotExist) {
+ // if dir does not exists try to create it
+ if err := os.MkdirAll(runtime.storageConfig.RunRoot, 0700); err != nil {
+ logrus.Warn(msg)
+ }
+ } else {
+ logrus.Warn(msg)
+ }
}
}
diff --git a/pkg/api/handlers/swagger/swagger.go b/pkg/api/handlers/swagger/swagger.go
index 2296eea3a..9844839b7 100644
--- a/pkg/api/handlers/swagger/swagger.go
+++ b/pkg/api/handlers/swagger/swagger.go
@@ -176,3 +176,12 @@ type swagInspectPodResponse struct {
define.InspectPodData
}
}
+
+// Get stats for one or more containers
+// swagger:response ContainerStats
+type swagContainerStatsResponse struct {
+ // in:body
+ Body struct {
+ define.ContainerStats
+ }
+}
diff --git a/pkg/api/server/register_containers.go b/pkg/api/server/register_containers.go
index 2a32966cc..8dcea1301 100644
--- a/pkg/api/server/register_containers.go
+++ b/pkg/api/server/register_containers.go
@@ -1124,11 +1124,9 @@ func (s *APIServer) registerContainersHandlers(r *mux.Router) error {
// - application/json
// responses:
// 200:
- // description: no error
+ // $ref: "#/responses/ContainerStats"
// 404:
// $ref: "#/responses/NoSuchContainer"
- // 409:
- // $ref: "#/responses/ConflictError"
// 500:
// $ref: "#/responses/InternalError"
r.HandleFunc(VersionedPath("/libpod/containers/stats"), s.APIHandler(libpod.StatsContainer)).Methods(http.MethodGet)