summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/containers/ps.go6
-rw-r--r--pkg/api/handlers/compat/containers_create.go1
-rw-r--r--pkg/api/handlers/compat/secrets.go8
-rw-r--r--pkg/api/handlers/compat/system.go1
-rw-r--r--pkg/domain/infra/abi/system.go2
-rw-r--r--pkg/specgen/generate/oci.go5
-rw-r--r--test/e2e/ps_test.go15
-rw-r--r--test/e2e/run_entrypoint_test.go12
8 files changed, 46 insertions, 4 deletions
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index 51e7bf5b5..55b53b4d9 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -22,6 +22,7 @@ import (
"github.com/cri-o/ocicni/pkg/ocicni"
"github.com/docker/go-units"
"github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -390,6 +391,11 @@ func (l psReporter) Command() string {
// Size returns the rootfs and virtual sizes in human duration in
// and output form (string) suitable for ps
func (l psReporter) Size() string {
+ if l.ListContainer.Size == nil {
+ logrus.Errorf("Size format requires --size option")
+ return ""
+ }
+
virt := units.HumanSizeWithPrecision(float64(l.ListContainer.Size.RootFsSize), 3)
s := units.HumanSizeWithPrecision(float64(l.ListContainer.Size.RwSize), 3)
return fmt.Sprintf("%s (virtual %s)", s, virt)
diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go
index 6e85872b2..4a39e9563 100644
--- a/pkg/api/handlers/compat/containers_create.go
+++ b/pkg/api/handlers/compat/containers_create.go
@@ -47,6 +47,7 @@ func CreateContainer(w http.ResponseWriter, r *http.Request) {
rtc, err := runtime.GetConfig()
if err != nil {
utils.Error(w, "unable to obtain runtime config", http.StatusInternalServerError, errors.Wrap(err, "unable to get runtime config"))
+ return
}
newImage, err := runtime.ImageRuntime().NewFromLocal(body.Config.Image)
diff --git a/pkg/api/handlers/compat/secrets.go b/pkg/api/handlers/compat/secrets.go
index 571888eba..ff737cddc 100644
--- a/pkg/api/handlers/compat/secrets.go
+++ b/pkg/api/handlers/compat/secrets.go
@@ -30,7 +30,9 @@ func ListSecrets(w http.ResponseWriter, r *http.Request) {
return
}
if len(query.Filters) > 0 {
- utils.Error(w, "filters not supported", http.StatusBadRequest, errors.New("bad parameter"))
+ utils.Error(w, "filters not supported", http.StatusBadRequest,
+ errors.Wrapf(errors.New("bad parameter"), "filters not supported"))
+ return
}
ic := abi.ContainerEngine{Libpod: runtime}
reports, err := ic.SecretList(r.Context())
@@ -95,7 +97,9 @@ func CreateSecret(w http.ResponseWriter, r *http.Request) {
return
}
if len(createParams.Labels) > 0 {
- utils.Error(w, "labels not supported", http.StatusBadRequest, errors.New("bad parameter"))
+ utils.Error(w, "labels not supported", http.StatusBadRequest,
+ errors.Wrapf(errors.New("bad parameter"), "labels not supported"))
+ return
}
decoded, _ := base64.StdEncoding.DecodeString(createParams.Data)
diff --git a/pkg/api/handlers/compat/system.go b/pkg/api/handlers/compat/system.go
index e21ae160a..66b4236f9 100644
--- a/pkg/api/handlers/compat/system.go
+++ b/pkg/api/handlers/compat/system.go
@@ -19,6 +19,7 @@ func GetDiskUsage(w http.ResponseWriter, r *http.Request) {
df, err := ic.SystemDf(r.Context(), options)
if err != nil {
utils.InternalServerError(w, err)
+ return
}
imgs := make([]*docker.ImageSummary, len(df.Images))
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index f29b98696..c68a12414 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -82,7 +82,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, cmd *cobra.Command)
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
if runsUnderSystemd || conf.Engine.CgroupManager == config.SystemdCgroupsManager {
if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil {
- logrus.Warnf("Failed to add podman to systemd sandbox cgroup: %v", err)
+ logrus.Debugf("Failed to add podman to systemd sandbox cgroup: %v", err)
}
}
}
diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go
index 1a0ec08a5..eefe45dfe 100644
--- a/pkg/specgen/generate/oci.go
+++ b/pkg/specgen/generate/oci.go
@@ -105,7 +105,10 @@ func makeCommand(ctx context.Context, s *specgen.SpecGenerator, img *image.Image
entrypoint = newEntry
}
- finalCommand = append(finalCommand, entrypoint...)
+ // Don't append the entrypoint if it is [""]
+ if len(entrypoint) != 1 || entrypoint[0] != "" {
+ finalCommand = append(finalCommand, entrypoint...)
+ }
// Only use image command if the user did not manually set an
// entrypoint.
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 225bd538e..016b4c8cd 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -350,6 +350,21 @@ var _ = Describe("Podman ps", func() {
Expect(session).To(ExitWithError())
})
+ It("podman --format by size", func() {
+ session := podmanTest.Podman([]string{"create", "busybox", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"create", "-t", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"ps", "-a", "--format", "{{.Size}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.ErrorToString()).To(ContainSubstring("Size format requires --size option"))
+ })
+
It("podman --sort by size", func() {
session := podmanTest.Podman([]string{"create", "busybox", "ls"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go
index cac3d759d..389f142b1 100644
--- a/test/e2e/run_entrypoint_test.go
+++ b/test/e2e/run_entrypoint_test.go
@@ -43,6 +43,18 @@ CMD []
Expect(session.ExitCode()).To(Equal(125))
})
+ It("podman run entrypoint == [\"\"]", func() {
+ dockerfile := `FROM quay.io/libpod/alpine:latest
+ENTRYPOINT [""]
+CMD []
+`
+ podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false")
+ session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "echo", "hello"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.OutputToString()).To(Equal("hello"))
+ })
+
It("podman run entrypoint", func() {
dockerfile := `FROM quay.io/libpod/alpine:latest
ENTRYPOINT ["grep", "Alpine", "/etc/os-release"]