From c3f1e7aec25cb5af3c5d9a04a0898409205123a0 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Mon, 12 Feb 2018 11:20:48 +0100 Subject: [PATCH] container_create: read ctr annotations for hooks first Signed-off-by: Antonio Murdaca --- server/container_create.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/container_create.go b/server/container_create.go index 0c4a3c80..2de24f67 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -757,6 +757,18 @@ func (s *Server) setupOCIHooks(specgen *generate.Generator, sb *sandbox.Sandbox, } } for _, annotationRegex := range hook.Annotations { + for _, annotation := range containerConfig.GetAnnotations() { + match, err := regexp.MatchString(annotationRegex, annotation) + if err != nil { + logrus.Errorf("Invalid regex %q:%q", annotationRegex, err) + continue + } + if match { + if err := addHook(hook); err != nil { + return err + } + } + } for _, annotation := range sb.Annotations() { match, err := regexp.MatchString(annotationRegex, annotation) if err != nil {