diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-01-07 08:43:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-07 08:43:53 -0800 |
commit | 148b4920dc9d866ce60654498af6e6bbc1d72f09 (patch) | |
tree | af89351f220b4ad8d5aa1758902533294aef1b4e /libpod/image | |
parent | d0b166023f0d909080f733a40a3f0606c9ad7509 (diff) | |
parent | 10a62d60a9b27626a47ab2bee00c32febb21f0e9 (diff) | |
download | podman-148b4920dc9d866ce60654498af6e6bbc1d72f09.tar.gz podman-148b4920dc9d866ce60654498af6e6bbc1d72f09.tar.bz2 podman-148b4920dc9d866ce60654498af6e6bbc1d72f09.zip |
Merge pull request #2075 from baude/runlabelname
container runlabel NAME implementation
Diffstat (limited to 'libpod/image')
-rw-r--r-- | libpod/image/parts.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libpod/image/parts.go b/libpod/image/parts.go index 1509005e5..9adf26fb9 100644 --- a/libpod/image/parts.go +++ b/libpod/image/parts.go @@ -22,6 +22,18 @@ func isRegistry(name string) bool { return strings.ContainsAny(name, ".:") || name == "localhost" } +// GetImageBaseName uses decompose and string splits to obtain the base +// name of an image. Doing this here because it beats changing the +// imageParts struct names to be exported as well. +func GetImageBaseName(input string) (string, error) { + decomposedImage, err := decompose(input) + if err != nil { + return "", err + } + splitImageName := strings.Split(decomposedImage.name, "/") + return splitImageName[len(splitImageName)-1], nil +} + // decompose breaks an input name into an imageParts description func decompose(input string) (imageParts, error) { var ( |