MCPcopy
hub / github.com/containers/toolbox / GetFullyQualifiedImageFromDistros

Function GetFullyQualifiedImageFromDistros

src/pkg/utils/utils.go:385–424  ·  view source on GitHub ↗
(image, release string)

Source from the content-addressed store, hash-verified

383}
384
385func GetFullyQualifiedImageFromDistros(image, release string) (string, error) {
386 logrus.Debugf("Resolving fully qualified name for image %s from known registries", image)
387
388 if image == "" {
389 panic("image not specified")
390 }
391
392 if release == "" {
393 panic("release not specified")
394 }
395
396 if tag := ImageReferenceGetTag(image); tag != "" && release != tag {
397 panicMsg := fmt.Sprintf("image %s does not match release %s", image, release)
398 panic(panicMsg)
399 }
400
401 if ImageReferenceHasDomain(image) {
402 return image, nil
403 }
404
405 basename := ImageReferenceGetBasename(image)
406 if basename == "" {
407 return "", fmt.Errorf("failed to get the basename of image %s", image)
408 }
409
410 for _, distroObj := range supportedDistros {
411 if distroObj.ImageBasename != basename {
412 continue
413 }
414
415 getFullyQualifiedImageImpl := distroObj.GetFullyQualifiedImage
416 imageFull := getFullyQualifiedImageImpl(image, release)
417
418 logrus.Debugf("Resolved image %s to %s", image, imageFull)
419
420 return imageFull, nil
421 }
422
423 return "", fmt.Errorf("failed to resolve image %s", image)
424}
425
426// GetGroupForSudo returns the name of the sudoers group.
427//

Callers

nothing calls this directly

Calls 3

ImageReferenceGetTagFunction · 0.85
ImageReferenceHasDomainFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…