summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkg/domain/infra/abi/images.go4
-rw-r--r--pkg/domain/infra/tunnel/images.go10
-rw-r--r--test/e2e/info_test.go42
-rw-r--r--test/e2e/untag_test.go1
4 files changed, 56 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go
index 32f7d75e5..d0b7b42b5 100644
--- a/pkg/domain/infra/abi/images.go
+++ b/pkg/domain/infra/abi/images.go
@@ -303,6 +303,10 @@ func (ir *ImageEngine) Untag(ctx context.Context, nameOrId string, tags []string
if err != nil {
return err
}
+ // If only one arg is provided, all names are to be untagged
+ if len(tags) == 0 {
+ tags = newImage.Names()
+ }
for _, tag := range tags {
if err := newImage.UntagImage(tag); err != nil {
return err
diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go
index 822842936..27ed9f1ec 100644
--- a/pkg/domain/infra/tunnel/images.go
+++ b/pkg/domain/infra/tunnel/images.go
@@ -7,6 +7,7 @@ import (
"github.com/containers/common/pkg/config"
"github.com/containers/image/v5/docker/reference"
+ "github.com/containers/libpod/pkg/bindings"
images "github.com/containers/libpod/pkg/bindings/images"
"github.com/containers/libpod/pkg/domain/entities"
"github.com/containers/libpod/pkg/domain/utils"
@@ -109,6 +110,15 @@ func (ir *ImageEngine) Tag(ctx context.Context, nameOrId string, tags []string,
}
func (ir *ImageEngine) Untag(ctx context.Context, nameOrId string, tags []string, options entities.ImageUntagOptions) error {
+ // Remove all tags if none are provided
+ if len(tags) == 0 {
+ newImage, err := images.GetImage(ir.ClientCxt, nameOrId, &bindings.PFalse)
+ if err != nil {
+ return err
+ }
+ tags = newImage.NamesHistory
+ }
+
for _, newTag := range tags {
var (
tag, repo string
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index ff3615dcd..7cb299e0f 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -1,8 +1,13 @@
package integration
import (
+ "fmt"
+ "io/ioutil"
"os"
+ "os/exec"
+ "path/filepath"
+ "github.com/containers/libpod/pkg/rootless"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -50,4 +55,41 @@ var _ = Describe("Podman Info", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring("registry"))
})
+
+ It("podman info rootless storage path", func() {
+ if !rootless.IsRootless() {
+ Skip("test of rootless_storage_path is only meaningful as rootless")
+ }
+ SkipIfRemote()
+ oldHOME, hasHOME := os.LookupEnv("HOME")
+ defer func() {
+ if hasHOME {
+ os.Setenv("HOME", oldHOME)
+ } else {
+ os.Unsetenv("HOME")
+ }
+ }()
+ os.Setenv("HOME", podmanTest.TempDir)
+ configPath := filepath.Join(os.Getenv("HOME"), ".config", "containers", "storage.conf")
+ err := os.RemoveAll(filepath.Dir(configPath))
+ Expect(err).To(BeNil())
+
+ err = os.MkdirAll(filepath.Dir(configPath), os.ModePerm)
+ Expect(err).To(BeNil())
+
+ rootlessStoragePath := `"/tmp/$HOME/$USER/$UID"`
+ driver := `"overlay"`
+ storageOpt := `"/usr/bin/fuse-overlayfs"`
+ storageConf := []byte(fmt.Sprintf("[storage]\ndriver=%s\nrootless_storage_path=%s\n[storage.options]\nmount_program=%s", driver, rootlessStoragePath, storageOpt))
+ err = ioutil.WriteFile(configPath, storageConf, os.ModePerm)
+ Expect(err).To(BeNil())
+
+ expect := filepath.Join("/tmp", os.Getenv("HOME"), os.Getenv("USER"), os.Getenv("UID"))
+ podmanPath := podmanTest.PodmanTest.PodmanBinary
+ cmd := exec.Command(podmanPath, "info", "--format", "{{.Store.GraphRoot}}")
+ out, err := cmd.CombinedOutput()
+ fmt.Println(string(out))
+ Expect(err).To(BeNil())
+ Expect(string(out)).To(ContainSubstring(expect))
+ })
})
diff --git a/test/e2e/untag_test.go b/test/e2e/untag_test.go
index 8b4b454db..17171cd41 100644
--- a/test/e2e/untag_test.go
+++ b/test/e2e/untag_test.go
@@ -16,7 +16,6 @@ var _ = Describe("Podman untag", func() {
)
BeforeEach(func() {
- Skip(v2fail)
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)