Skip to content

Commit

Permalink
Initialize cm.Data if it is nil. This happens if the configMap exists…
Browse files Browse the repository at this point in the history
… but does not have any data in it, and in this case it was not possible to update the dashboard settings. (#3280)

Signed-off-by: Stefan Sundin <[email protected]>
  • Loading branch information
stefansundin authored and Marcin Maciaszczyk committed Oct 8, 2018
1 parent 07fb4d4 commit 15725cd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/backend/settings/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ func (sm *SettingsManager) SaveGlobalSettings(client kubernetes.Interface, s *ap
return errors.New(api.ConcurrentSettingsChangeError)
}

// Data can be nil if the configMap exists but does not have any data
if cm.Data == nil {
cm.Data = make(map[string]string)
}

cm.Data[api.GlobalSettingsKey] = s.Marshal()
_, err := client.CoreV1().ConfigMaps(api.SettingsConfigMapNamespace).Update(cm)
return err
Expand Down

0 comments on commit 15725cd

Please sign in to comment.