Obliterate mappings/env variables if passed through, since we want to completely replace those arrays

This commit is contained in:
Dane Everitt 2019-11-24 20:54:03 -08:00
parent 69aa559bcf
commit c684410722
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -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()
}
}