diff --git a/api/docker/snapshot.go b/api/docker/snapshot.go index e03a76496..7d7ceea8e 100644 --- a/api/docker/snapshot.go +++ b/api/docker/snapshot.go @@ -2,6 +2,7 @@ package docker import ( "context" + "log" "time" "github.com/docker/docker/api/types" @@ -10,7 +11,7 @@ import ( "github.com/portainer/portainer/api" ) -func snapshot(cli *client.Client) (*portainer.Snapshot, error) { +func snapshot(cli *client.Client, endpoint *portainer.Endpoint) (*portainer.Snapshot, error) { _, err := cli.Ping(context.Background()) if err != nil { return nil, err @@ -22,44 +23,44 @@ func snapshot(cli *client.Client) (*portainer.Snapshot, error) { err = snapshotInfo(snapshot, cli) if err != nil { - return nil, err + log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot engine information] [endpoint: %s] [err: %s]", endpoint.Name, err) } if snapshot.Swarm { err = snapshotSwarmServices(snapshot, cli) if err != nil { - return nil, err + log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot Swarm services] [endpoint: %s] [err: %s]", endpoint.Name, err) } err = snapshotNodes(snapshot, cli) if err != nil { - return nil, err + log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot Swarm nodes] [endpoint: %s] [err: %s]", endpoint.Name, err) } } err = snapshotContainers(snapshot, cli) if err != nil { - return nil, err + log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot containers] [endpoint: %s] [err: %s]", endpoint.Name, err) } err = snapshotImages(snapshot, cli) if err != nil { - return nil, err + log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot images] [endpoint: %s] [err: %s]", endpoint.Name, err) } err = snapshotVolumes(snapshot, cli) if err != nil { - return nil, err + log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot volumes] [endpoint: %s] [err: %s]", endpoint.Name, err) } err = snapshotNetworks(snapshot, cli) if err != nil { - return nil, err + log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot networks] [endpoint: %s] [err: %s]", endpoint.Name, err) } err = snapshotVersion(snapshot, cli) if err != nil { - return nil, err + log.Printf("[WARN] [docker,snapshot] [message: unable to snapshot engine version] [endpoint: %s] [err: %s]", endpoint.Name, err) } snapshot.Time = time.Now().Unix() diff --git a/api/docker/snapshotter.go b/api/docker/snapshotter.go index 24d121845..25eceb023 100644 --- a/api/docker/snapshotter.go +++ b/api/docker/snapshotter.go @@ -24,5 +24,5 @@ func (snapshotter *Snapshotter) CreateSnapshot(endpoint *portainer.Endpoint) (*p } defer cli.Close() - return snapshot(cli) + return snapshot(cli, endpoint) }