fix minor error scoping mistakes

This commit is contained in:
Frederik Ring 2021-11-28 20:06:24 +01:00
parent b6ad624115
commit 7bc5b2ccef

View File

@ -316,11 +316,10 @@ func (s *script) stopContainers() (func() error, error) {
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 serviceMatch.Spec.TaskTemplate.ForceUpdate = 1
_, err := s.cli.ServiceUpdate( if _, err := s.cli.ServiceUpdate(
context.Background(), serviceMatch.ID, context.Background(), serviceMatch.ID,
serviceMatch.Version, serviceMatch.Spec, types.ServiceUpdateOptions{}, serviceMatch.Version, serviceMatch.Spec, types.ServiceUpdateOptions{},
) ); err != nil {
if err != nil {
restartErrors = append(restartErrors, err) restartErrors = append(restartErrors, err)
} }
} }
@ -431,10 +430,9 @@ func (s *script) encryptBackup() error {
func (s *script) copyBackup() error { func (s *script) copyBackup() error {
_, name := path.Split(s.file) _, name := path.Split(s.file)
if s.mc != nil { if s.mc != nil {
_, err := s.mc.FPutObject(context.Background(), s.c.AwsS3BucketName, name, s.file, minio.PutObjectOptions{ if _, err := s.mc.FPutObject(context.Background(), s.c.AwsS3BucketName, name, s.file, minio.PutObjectOptions{
ContentType: "application/tar+gzip", ContentType: "application/tar+gzip",
}) }); err != nil {
if err != nil {
return fmt.Errorf("copyBackup: error uploading backup to remote storage: %w", err) return fmt.Errorf("copyBackup: error uploading backup to remote storage: %w", err)
} }
s.logger.Infof("Uploaded a copy of backup `%s` to bucket `%s`.", s.file, s.c.AwsS3BucketName) s.logger.Infof("Uploaded a copy of backup `%s` to bucket `%s`.", s.file, s.c.AwsS3BucketName)