Compare commits

...

3 Commits

Author SHA1 Message Date
Frederik Ring
6034e6a902 print proper local archive in log message 2021-08-29 08:36:45 +02:00
Frederik Ring
d0eca0a179 fix container stop execution order 2021-08-26 16:22:24 +02:00
Frederik Ring
a0fe2cf42d handle errors on container restart 2021-08-26 12:50:22 +02:00

View File

@@ -37,7 +37,9 @@ func main() {
s.must(func() error {
restartContainers, err := s.stopContainers()
defer restartContainers()
defer func() {
s.must(restartContainers())
}()
if err != nil {
return err
}
@@ -219,7 +221,7 @@ func (s *script) stopContainers() (func() error, error) {
}
}
if serviceMatch.ID == "" {
return fmt.Errorf("stopContainersAndRun: Couldn't find service with name %s", serviceName)
return fmt.Errorf("stopContainersAndRun: couldn't find service with name %s", serviceName)
}
serviceMatch.Spec.TaskTemplate.ForceUpdate = 1
_, err := s.cli.ServiceUpdate(
@@ -316,7 +318,7 @@ func (s *script) copyBackup() error {
if err := copy(s.file, path.Join(s.c.BackupArchive, name)); err != nil {
return fmt.Errorf("copyBackup: error copying file to local archive: %w", err)
}
s.logger.Infof("Stored copy of backup `%s` in local archive `%s`", s.file, s.c.AwsS3BucketName)
s.logger.Infof("Stored copy of backup `%s` in local archive `%s`", s.file, s.c.BackupArchive)
}
return nil
}
@@ -391,9 +393,10 @@ func (s *script) pruneOldBackups() error {
)
}
s.logger.Infof(
"Pruned %d out of %d remote backup(s) as their age exceeded the configured retention period.",
"Pruned %d out of %d remote backup(s) as their age exceeded the configured retention period of %d days.",
len(matches),
lenCandidates,
s.c.BackupRetentionDays,
)
} else if len(matches) != 0 && len(matches) == lenCandidates {
s.logger.Warnf(
@@ -447,9 +450,10 @@ func (s *script) pruneOldBackups() error {
)
}
s.logger.Infof(
"Pruned %d out of %d local backup(s) as their age exceeded the configured retention period.",
"Pruned %d out of %d local backup(s) as their age exceeded the configured retention period of %d days.",
len(matches),
len(candidates),
s.c.BackupRetentionDays,
)
} else if len(matches) != 0 && len(matches) == len(candidates) {
s.logger.Warnf(