fix(sync): revert code which removed image destination feature (#840)

Added an end to end test for this feature, closes #793

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu
2022-10-05 21:03:24 +03:00
committed by GitHub
parent 33a431ef43
commit c146448f01
4 changed files with 196 additions and 16 deletions
+9 -1
View File
@@ -598,10 +598,18 @@ func validateSync(config *config.Config) error {
for _, content := range regCfg.Content {
ok := glob.ValidatePattern(content.Prefix)
if !ok {
log.Error().Err(glob.ErrBadPattern).Str("pattern", content.Prefix).Msg("sync pattern could not be compiled")
log.Error().Err(glob.ErrBadPattern).Str("prefix", content.Prefix).Msg("sync prefix could not be compiled")
return glob.ErrBadPattern
}
if content.StripPrefix && !strings.Contains(content.Prefix, "/*") && content.Destination == "/" {
log.Error().Err(errors.ErrBadConfig).
Interface("sync content", content).
Msg("sync config: can not use stripPrefix true and destination '/' without using glob patterns in prefix")
return errors.ErrBadConfig
}
}
}
}