mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 05:10:28 +01:00
Fix more error strings
This commit is contained in:
parent
eb9a198327
commit
00c83dfac7
@ -63,7 +63,7 @@ func compress(paths []string, outFilePath, subPath string) error {
|
|||||||
|
|
||||||
for _, p := range paths {
|
for _, p := range paths {
|
||||||
if err := writeTarGz(p, tarWriter, prefix); err != nil {
|
if err := writeTarGz(p, tarWriter, prefix); err != nil {
|
||||||
return fmt.Errorf("compress error writing %s to archive: %w", p, err)
|
return fmt.Errorf("compress: error writing %s to archive: %w", p, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ func (s *script) lock(lockfile string) (func() error, error) {
|
|||||||
for {
|
for {
|
||||||
acquired, err := fileLock.TryLock()
|
acquired, err := fileLock.TryLock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return noop, fmt.Errorf("lock: error trying lock: %w", err)
|
return noop, fmt.Errorf("lock: error trying to lock: %w", err)
|
||||||
}
|
}
|
||||||
if acquired {
|
if acquired {
|
||||||
if s.encounteredLock {
|
if s.encounteredLock {
|
||||||
|
@ -36,16 +36,16 @@ func (s *script) notify(titleTemplate string, bodyTemplate string, err error) er
|
|||||||
|
|
||||||
titleBuf := &bytes.Buffer{}
|
titleBuf := &bytes.Buffer{}
|
||||||
if err := s.template.ExecuteTemplate(titleBuf, titleTemplate, params); err != nil {
|
if err := s.template.ExecuteTemplate(titleBuf, titleTemplate, params); err != nil {
|
||||||
return fmt.Errorf("notifyFailure: error executing %s template: %w", titleTemplate, err)
|
return fmt.Errorf("notify: error executing %s template: %w", titleTemplate, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
bodyBuf := &bytes.Buffer{}
|
bodyBuf := &bytes.Buffer{}
|
||||||
if err := s.template.ExecuteTemplate(bodyBuf, bodyTemplate, params); err != nil {
|
if err := s.template.ExecuteTemplate(bodyBuf, bodyTemplate, params); err != nil {
|
||||||
return fmt.Errorf("notifyFailure: error executing %s template: %w", bodyTemplate, err)
|
return fmt.Errorf("notify: error executing %s template: %w", bodyTemplate, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.sendNotification(titleBuf.String(), bodyBuf.String()); err != nil {
|
if err := s.sendNotification(titleBuf.String(), bodyBuf.String()); err != nil {
|
||||||
return fmt.Errorf("notifyFailure: error notifying: %w", err)
|
return fmt.Errorf("notify: error notifying: %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -258,7 +258,7 @@ func (s *script) stopContainers() (func() error, error) {
|
|||||||
Quiet: true,
|
Quiet: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return noop, fmt.Errorf("stopContainersAndRun: error querying for containers: %w", err)
|
return noop, fmt.Errorf("stopContainers: error querying for containers: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
containerLabel := fmt.Sprintf(
|
containerLabel := fmt.Sprintf(
|
||||||
@ -274,7 +274,7 @@ func (s *script) stopContainers() (func() error, error) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return noop, fmt.Errorf("stopContainersAndRun: error querying for containers to stop: %w", err)
|
return noop, fmt.Errorf("stopContainers: error querying for containers to stop: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(containersToStop) == 0 {
|
if len(containersToStop) == 0 {
|
||||||
@ -301,7 +301,7 @@ func (s *script) stopContainers() (func() error, error) {
|
|||||||
var stopError error
|
var stopError error
|
||||||
if len(stopErrors) != 0 {
|
if len(stopErrors) != 0 {
|
||||||
stopError = fmt.Errorf(
|
stopError = fmt.Errorf(
|
||||||
"stopContainersAndRun: %d error(s) stopping containers: %w",
|
"stopContainers: %d error(s) stopping containers: %w",
|
||||||
len(stopErrors),
|
len(stopErrors),
|
||||||
utilities.Join(stopErrors...),
|
utilities.Join(stopErrors...),
|
||||||
)
|
)
|
||||||
@ -338,7 +338,7 @@ func (s *script) stopContainers() (func() error, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if serviceMatch.ID == "" {
|
if serviceMatch.ID == "" {
|
||||||
return fmt.Errorf("stopContainersAndRun: couldn't find service with name %s", serviceName)
|
return fmt.Errorf("stopContainers: couldn't find service with name %s", serviceName)
|
||||||
}
|
}
|
||||||
serviceMatch.Spec.TaskTemplate.ForceUpdate = 1
|
serviceMatch.Spec.TaskTemplate.ForceUpdate = 1
|
||||||
if _, err := s.cli.ServiceUpdate(
|
if _, err := s.cli.ServiceUpdate(
|
||||||
@ -352,7 +352,7 @@ func (s *script) stopContainers() (func() error, error) {
|
|||||||
|
|
||||||
if len(restartErrors) != 0 {
|
if len(restartErrors) != 0 {
|
||||||
return fmt.Errorf(
|
return fmt.Errorf(
|
||||||
"stopContainersAndRun: %d error(s) restarting containers and services: %w",
|
"stopContainers: %d error(s) restarting containers and services: %w",
|
||||||
len(restartErrors),
|
len(restartErrors),
|
||||||
utilities.Join(restartErrors...),
|
utilities.Join(restartErrors...),
|
||||||
)
|
)
|
||||||
@ -381,7 +381,7 @@ func (s *script) createArchive() error {
|
|||||||
// copy before compressing guard against a situation where backup folder's content are still growing.
|
// copy before compressing guard against a situation where backup folder's content are still growing.
|
||||||
s.registerHook(hookLevelPlumbing, func(error) error {
|
s.registerHook(hookLevelPlumbing, func(error) error {
|
||||||
if err := remove(backupSources); err != nil {
|
if err := remove(backupSources); err != nil {
|
||||||
return fmt.Errorf("takeBackup: error removing snapshot: %w", err)
|
return fmt.Errorf("createArchive: error removing snapshot: %w", err)
|
||||||
}
|
}
|
||||||
s.logger.Infof("Removed snapshot `%s`.", backupSources)
|
s.logger.Infof("Removed snapshot `%s`.", backupSources)
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user