Fix error handling on invalid regex

Say that the regex is the cause, include it in the error message,
and don't continue as if the compilation succeeded.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač 2020-05-22 03:36:42 +02:00 committed by Valentin Rothberg
parent c103d65284
commit 8b4b954332

View File

@ -344,8 +344,11 @@ func imagesToCopyFromRegistry(registryName string, cfg registrySyncConfig, sourc
tagReg, err := regexp.Compile(tagRegex)
if err != nil {
repoLogger.Error("Error processing repo, skipping")
repoLogger.WithFields(logrus.Fields{
"regex": tagRegex,
}).Error("Error parsing regex, skipping")
logrus.Error(err)
continue
}
repoLogger.Info("Querying registry for image tags")