mirror of
https://github.com/containers/podman.git
synced 2025-10-17 03:04:21 +08:00
Image library stage 4 - create and commit
Migrate the podman create and commit subcommandis to leverage the images library. I also had to migrate the cmd/ portions of run and rmi. Signed-off-by: baude <bbaude@redhat.com> Closes: #498 Approved by: mheon
This commit is contained in:
@ -2,15 +2,14 @@ package image
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
cp "github.com/containers/image/copy"
|
||||
"github.com/containers/image/docker/reference"
|
||||
"github.com/containers/storage"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/containers/image/signature"
|
||||
"github.com/containers/image/types"
|
||||
"strings"
|
||||
"github.com/containers/storage"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func getTags(nameInput string) (reference.NamedTagged, bool, error) {
|
||||
@ -36,14 +35,19 @@ func findImageInRepotags(search imageParts, images []*Image) (*storage.Image, er
|
||||
}
|
||||
if d.name == search.name && d.tag == search.tag {
|
||||
results = append(results, image.image)
|
||||
break
|
||||
continue
|
||||
}
|
||||
// account for registry:/somedir/image
|
||||
if strings.HasSuffix(d.name, search.name) && d.tag == search.tag {
|
||||
results = append(results, image.image)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(results) == 0 {
|
||||
return &storage.Image{}, errors.Errorf("unable to find a name and tag match for %s in repotags", search)
|
||||
return &storage.Image{}, errors.Errorf("unable to find a name and tag match for %s in repotags", search.name)
|
||||
} else if len(results) > 1 {
|
||||
return &storage.Image{}, errors.Errorf("found multiple name and tag matches for %s in repotags", search)
|
||||
return &storage.Image{}, errors.Errorf("found multiple name and tag matches for %s in repotags", search.name)
|
||||
}
|
||||
return results[0], nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user