fix: don't stop everything when one container could not be backed up
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
Resolves #3
This commit is contained in:
parent
bd72e06825
commit
42932f91d2
9
dump.go
9
dump.go
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
|
"github.com/google/martian/log"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -26,18 +27,16 @@ func NewDumperFromContainer(container *types.ContainerJSON) Dumper {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func dumpAllDatabases(c *client.Client) error {
|
func dumpAllDatabases(c *client.Client) {
|
||||||
lock.Lock()
|
lock.Lock()
|
||||||
defer lock.Unlock()
|
defer lock.Unlock()
|
||||||
|
|
||||||
for _, dumper := range store {
|
for containerID, dumper := range store {
|
||||||
err := dumper.Dump(c)
|
err := dumper.Dump(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
log.Errorf("Could not dump database from container %s: %v", containerID, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDumpFilename(containerName string) string {
|
func getDumpFilename(containerName string) string {
|
||||||
|
|
5
main.go
5
main.go
|
@ -27,10 +27,7 @@ func main() {
|
||||||
log.Fatalf("Could not clean old backups: %s", err)
|
log.Fatalf("Could not clean old backups: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dumpAllDatabases(c)
|
dumpAllDatabases(c)
|
||||||
if err != nil {
|
|
||||||
log.Fatalf("Could not dump databases: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = callWebhook()
|
err = callWebhook()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue