mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-14 02:25:49 +01:00
Log warnings from Docker when updating services
This commit is contained in:
parent
4e38760e5a
commit
a430772e29
@ -441,9 +441,16 @@ func (s *script) stopContainersAndServices() (func() error, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = s.cli.ServiceUpdate(context.Background(), service.ID, service.Version, service.Spec, types.ServiceUpdateOptions{})
|
response, err := s.cli.ServiceUpdate(context.Background(), service.ID, service.Version, service.Spec, types.ServiceUpdateOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
scaleDownErrors = append(scaleDownErrors, err)
|
scaleDownErrors = append(scaleDownErrors, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, warning := range response.Warnings {
|
||||||
|
s.logger.Warn(
|
||||||
|
fmt.Sprintf("The Docker API returned a warning when scaling down service %s: %s", service.Spec.Name, warning),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := progress.ServiceProgress(context.Background(), s.cli, service.ID, discardWriter); err != nil {
|
if err := progress.ServiceProgress(context.Background(), s.cli, service.ID, discardWriter); err != nil {
|
||||||
@ -529,13 +536,20 @@ func (s *script) stopContainersAndServices() (func() error, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
service.Spec.Mode.Replicated.Replicas = &svc.initialReplicaCount
|
service.Spec.Mode.Replicated.Replicas = &svc.initialReplicaCount
|
||||||
if _, err := s.cli.ServiceUpdate(
|
response, err := s.cli.ServiceUpdate(
|
||||||
context.Background(),
|
context.Background(),
|
||||||
service.ID,
|
service.ID,
|
||||||
service.Version, service.Spec,
|
service.Version, service.Spec,
|
||||||
types.ServiceUpdateOptions{},
|
types.ServiceUpdateOptions{},
|
||||||
); err != nil {
|
)
|
||||||
|
if err != nil {
|
||||||
scaleUpErrors = append(scaleUpErrors, err)
|
scaleUpErrors = append(scaleUpErrors, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
for _, warning := range response.Warnings {
|
||||||
|
s.logger.Warn(
|
||||||
|
fmt.Sprintf("The Docker API returned a warning when scaling up service %s: %s", service.Spec.Name, warning),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if err := progress.ServiceProgress(context.Background(), s.cli, service.ID, discardWriter); err != nil {
|
if err := progress.ServiceProgress(context.Background(), s.cli, service.ID, discardWriter); err != nil {
|
||||||
scaleUpErrors = append(scaleUpErrors, err)
|
scaleUpErrors = append(scaleUpErrors, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user