mirror of https://github.com/containers/image.git
API transition: Drop XNamed.XFullName
Instead call distreference.Named.Name() in all users. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
5240b7c4bb
commit
df65181c70
|
|
@ -230,7 +230,7 @@ func (d *daemonImageDestination) PutManifest(m []byte) error {
|
|||
// a hostname-qualified reference.
|
||||
// See https://github.com/containers/image/issues/72 for a more detailed
|
||||
// analysis and explanation.
|
||||
refString := fmt.Sprintf("%s:%s", d.namedTaggedRef.XFullName(), d.namedTaggedRef.XTag())
|
||||
refString := fmt.Sprintf("%s:%s", d.namedTaggedRef.Name(), d.namedTaggedRef.XTag())
|
||||
|
||||
items := []manifestItem{{
|
||||
Config: man.Config.Digest.String(),
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ func newImage(ctx *types.SystemContext, ref dockerReference) (types.Image, error
|
|||
|
||||
// SourceRefFullName returns a fully expanded name for the repository this image is in.
|
||||
func (i *Image) SourceRefFullName() string {
|
||||
return i.src.ref.ref.XFullName()
|
||||
return i.src.ref.ref.Name()
|
||||
}
|
||||
|
||||
// GetRepositoryTags list all tags available in the repository. Note that this has no connection with the tag(s) used for this specific image, if any.
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ func configuredSignatureStorageBase(ctx *types.SystemContext, ref dockerReferenc
|
|||
return nil, errors.Wrapf(err, "Invalid signature storage URL %s", topLevel)
|
||||
}
|
||||
// FIXME? Restrict to explicitly supported schemes?
|
||||
repo := ref.ref.XFullName() // Note that this is without a tag or digest.
|
||||
repo := ref.ref.Name() // Note that this is without a tag or digest.
|
||||
if path.Clean(repo) != repo { // Coverage: This should not be reachable because /./ and /../ components are not valid in docker references
|
||||
return nil, errors.Errorf("Unexpected path elements in Docker reference %s for signature storage", ref.ref.XString())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
// as a backend for ImageReference.PolicyConfigurationIdentity.
|
||||
// The reference must satisfy !reference.XIsNameOnly().
|
||||
func DockerReferenceIdentity(ref reference.XNamed) (string, error) {
|
||||
res := ref.XFullName()
|
||||
res := ref.Name()
|
||||
tagged, isTagged := ref.(reference.XNamedTagged)
|
||||
digested, isDigested := ref.(reference.XCanonical)
|
||||
switch {
|
||||
|
|
@ -43,7 +43,7 @@ func DockerReferenceNamespaces(ref reference.XNamed) []string {
|
|||
// ref.FullName() == ref.Hostname() + "/" + ref.RemoteName(), so the last
|
||||
// iteration matches the host name (for any namespace).
|
||||
res := []string{}
|
||||
name := ref.XFullName()
|
||||
name := ref.Name()
|
||||
for {
|
||||
res = append(res, name)
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,6 @@ type XNamed interface {
|
|||
XName() string
|
||||
// XString returns full reference, like "ubuntu@sha256:abcdef..."
|
||||
XString() string
|
||||
// XFullName returns full repository name with hostname, like "docker.io/library/ubuntu"
|
||||
XFullName() string
|
||||
// XHostname returns hostname for the reference, like "docker.io"
|
||||
XHostname() string
|
||||
// XRemoteName returns the repository component of the full name, like "library/ubuntu"
|
||||
|
|
@ -140,9 +138,6 @@ func (r *namedRef) XName() string {
|
|||
func (r *namedRef) XString() string {
|
||||
return distreference.FamiliarString(r)
|
||||
}
|
||||
func (r *namedRef) XFullName() string {
|
||||
return r.Name()
|
||||
}
|
||||
func (r *namedRef) XHostname() string {
|
||||
return distreference.Domain(r)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ func TestParseRepositoryInfo(t *testing.T) {
|
|||
if expected, actual := tcase.NormalizedName, r.XName(); expected != actual {
|
||||
t.Fatalf("Invalid normalized reference for %q. Expected %q, got %q", r, expected, actual)
|
||||
}
|
||||
if expected, actual := tcase.FullName, r.XFullName(); expected != actual {
|
||||
if expected, actual := tcase.FullName, r.Name(); expected != actual {
|
||||
t.Fatalf("Invalid normalized reference for %q. Expected %q, got %q", r, expected, actual)
|
||||
}
|
||||
if expected, actual := tcase.Hostname, r.XHostname(); expected != actual {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ func (s storageReference) PolicyConfigurationNamespaces() []string {
|
|||
// The reference without the ID is also a valid namespace.
|
||||
namespaces = append(namespaces, storeSpec+s.reference)
|
||||
}
|
||||
components := strings.Split(s.name.XFullName(), "/")
|
||||
components := strings.Split(s.name.Name(), "/")
|
||||
for len(components) > 0 {
|
||||
namespaces = append(namespaces, storeSpec+strings.Join(components, "/"))
|
||||
components = components[:len(components)-1]
|
||||
|
|
|
|||
|
|
@ -282,5 +282,5 @@ func verboseName(name reference.XNamed) string {
|
|||
if tagged, ok := name.(reference.XNamedTagged); ok {
|
||||
tag = tagged.XTag()
|
||||
}
|
||||
return name.XFullName() + ":" + tag
|
||||
return name.Name() + ":" + tag
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue