mirror of
https://github.com/containers/podman.git
synced 2025-12-16 20:47:47 +08:00
Merge pull request #5944 from rhatdan/untag
Fix integration tests for untag
This commit is contained in:
@@ -303,6 +303,10 @@ func (ir *ImageEngine) Untag(ctx context.Context, nameOrId string, tags []string
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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 {
|
for _, tag := range tags {
|
||||||
if err := newImage.UntagImage(tag); err != nil {
|
if err := newImage.UntagImage(tag); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/containers/common/pkg/config"
|
"github.com/containers/common/pkg/config"
|
||||||
"github.com/containers/image/v5/docker/reference"
|
"github.com/containers/image/v5/docker/reference"
|
||||||
|
"github.com/containers/libpod/pkg/bindings"
|
||||||
images "github.com/containers/libpod/pkg/bindings/images"
|
images "github.com/containers/libpod/pkg/bindings/images"
|
||||||
"github.com/containers/libpod/pkg/domain/entities"
|
"github.com/containers/libpod/pkg/domain/entities"
|
||||||
"github.com/containers/libpod/pkg/domain/utils"
|
"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 {
|
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 {
|
for _, newTag := range tags {
|
||||||
var (
|
var (
|
||||||
tag, repo string
|
tag, repo string
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ var _ = Describe("Podman untag", func() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
BeforeEach(func() {
|
BeforeEach(func() {
|
||||||
Skip(v2fail)
|
|
||||||
tempdir, err = CreateTempDirInTempDir()
|
tempdir, err = CreateTempDirInTempDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user