container_create: read ctr annotations for hooks first
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
ebb88f9a67
commit
c3f1e7aec2
1 changed files with 12 additions and 0 deletions
|
@ -757,6 +757,18 @@ func (s *Server) setupOCIHooks(specgen *generate.Generator, sb *sandbox.Sandbox,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, annotationRegex := range hook.Annotations {
|
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() {
|
for _, annotation := range sb.Annotations() {
|
||||||
match, err := regexp.MatchString(annotationRegex, annotation)
|
match, err := regexp.MatchString(annotationRegex, annotation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue