summaryrefslogtreecommitdiff
path: root/libpod/image/parts.go
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2019-01-09 21:47:50 +0100
committerMiloslav Trmač <mitr@redhat.com>2019-01-14 04:07:24 +0100
commit449116af19305a567933effaced5a0a21a8c71be (patch)
tree854b66b38db0ef397c9b0911cbf95da7f2849b48 /libpod/image/parts.go
parent797d194050d4b7b78d255d19f4099463dc048425 (diff)
downloadpodman-449116af19305a567933effaced5a0a21a8c71be.tar.gz
podman-449116af19305a567933effaced5a0a21a8c71be.tar.bz2
podman-449116af19305a567933effaced5a0a21a8c71be.zip
Remove imageParts.{isTagged,registry,name,tag}
Finally, these members no longer have any users. Future users should usually call referenceWithRegistry / normalizedReference, and work with the returned value, instead of reintroducing these variables. Similarly, direct uses of unnormalizedRef should be rare (only for cases where the registry and/or path truly does not matter). Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'libpod/image/parts.go')
-rw-r--r--libpod/image/parts.go35
1 files changed, 2 insertions, 33 deletions
diff --git a/libpod/image/parts.go b/libpod/image/parts.go
index 62cca2757..dfdf0b08a 100644
--- a/libpod/image/parts.go
+++ b/libpod/image/parts.go
@@ -10,10 +10,6 @@ import (
// imageParts describes the parts of an image's name
type imageParts struct {
unnormalizedRef reference.Named // WARNING: Did not go through docker.io[/library] normalization
- registry string
- name string
- tag string
- isTagged bool
hasRegistry bool
}
@@ -37,45 +33,18 @@ func GetImageBaseName(input string) (string, error) {
// decompose breaks an input name into an imageParts description
func decompose(input string) (imageParts, error) {
- var (
- parts imageParts
- hasRegistry bool
- tag string
- )
imgRef, err := reference.Parse(input)
if err != nil {
- return parts, err
+ return imageParts{}, err
}
unnormalizedNamed := imgRef.(reference.Named)
- ntag, isTagged := imgRef.(reference.NamedTagged)
- if !isTagged {
- tag = "latest"
- if _, hasDigest := imgRef.(reference.Digested); hasDigest {
- tag = "none"
- }
- } else {
- tag = ntag.Tag()
- }
- registry := reference.Domain(unnormalizedNamed)
- imageName := reference.Path(unnormalizedNamed)
// ip.unnormalizedRef, because it uses reference.Parse and not reference.ParseNormalizedNamed,
// does not use the standard heuristics for domains vs. namespaces/repos, so we need to check
// explicitly.
- if isRegistry(registry) {
- hasRegistry = true
- } else {
- if registry != "" {
- imageName = registry + "/" + imageName
- registry = ""
- }
- }
+ hasRegistry := isRegistry(reference.Domain(unnormalizedNamed))
return imageParts{
unnormalizedRef: unnormalizedNamed,
- registry: registry,
hasRegistry: hasRegistry,
- name: imageName,
- tag: tag,
- isTagged: isTagged,
}, nil
}