From c6844107222d88f22d66487de3bdb282a627625f Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 24 Nov 2019 20:54:03 -0800 Subject: [PATCH] Obliterate mappings/env variables if passed through, since we want to completely replace those arrays --- server/update.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/server/update.go b/server/update.go index 9374d69..6332929 100644 --- a/server/update.go +++ b/server/update.go @@ -44,10 +44,20 @@ func (s *Server) UpdateDataStructure(data []byte) error { s.Container.OomDisabled = v } + // Environment and Mappings should be treated as a full update at all times, never a + // true patch, otherwise we can't know what we're passing along. + if len(src.EnvVars) > 0 { + s.EnvVars = src.EnvVars + } + + if len(src.Allocations.Mappings) > 0 { + s.Allocations.Mappings = src.Allocations.Mappings + } + s.Container.RebuildRequired = true if _, err := s.WriteConfigurationToDisk(); err != nil { return errors.WithStack(err) } return s.Environment.InSituUpdate() -} \ No newline at end of file +}