Correctly handle empty values from the API requests; mergo by default thinks these "empty" values should be skipped

This commit is contained in:
Dane Everitt
2020-05-31 12:42:10 -07:00
parent 62e5547c6d
commit 0ae286d617
2 changed files with 15 additions and 6 deletions

View File

@@ -122,11 +122,13 @@ func (d *DockerEnvironment) InSituUpdate() error {
return errors.WithStack(err)
}
ctx, _ := context.WithTimeout(context.Background(), time.Second * 10)
u := container.UpdateConfig{
Resources: d.getResourcesForServer(),
}
if _, err := d.Client.ContainerUpdate(context.Background(), d.Server.Uuid, u); err != nil {
d.Server.Log().WithField("limits", fmt.Sprintf("%+v", u.Resources)).Debug("updating server container on-the-fly with passed limits")
if _, err := d.Client.ContainerUpdate(ctx, d.Server.Uuid, u); err != nil {
return errors.WithStack(err)
}