diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2018-10-02 17:16:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-02 17:16:43 -0700 |
commit | d5687946f6a0aa14a5326f26ca0ceca68588056f (patch) | |
tree | 888c74c05f061cda2f53829969634e31a0d41643 /libpod/image | |
parent | b63b1f9cb638db4bc3fdf69a50857b6d04efb6d7 (diff) | |
parent | 4f825f2e079c1cf3ec6c9fd2c5378ce2db18d4f0 (diff) | |
download | podman-d5687946f6a0aa14a5326f26ca0ceca68588056f.tar.gz podman-d5687946f6a0aa14a5326f26ca0ceca68588056f.tar.bz2 podman-d5687946f6a0aa14a5326f26ca0ceca68588056f.zip |
Merge pull request #1528 from baude/runlabel
Add container runlabel command
Diffstat (limited to 'libpod/image')
-rw-r--r-- | libpod/image/image.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/image/image.go b/libpod/image/image.go index 197a83dc1..f39b1d78d 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -744,6 +744,20 @@ func (i *Image) Labels(ctx context.Context) (map[string]string, error) { return imgInspect.Labels, nil } +// GetLabel Returns a case-insensitive match of a given label +func (i *Image) GetLabel(ctx context.Context, label string) (string, error) { + imageLabels, err := i.Labels(ctx) + if err != nil { + return "", err + } + for k, v := range imageLabels { + if strings.ToLower(k) == strings.ToLower(label) { + return v, nil + } + } + return "", nil +} + // Annotations returns the annotations of an image func (i *Image) Annotations(ctx context.Context) (map[string]string, error) { manifest, manifestType, err := i.Manifest(ctx) |