mirror of https://github.com/grafana/grafana.git
Attempt to preserve UID from migrated channel (#57639)
This commit is contained in:
parent
96c3a8339e
commit
0dfd78c88c
|
|
@ -177,10 +177,23 @@ func (m *migration) getNotificationChannelMap() (channelsPerOrg, defaultChannels
|
|||
|
||||
// Create a notifier (PostableGrafanaReceiver) from a legacy notification channel
|
||||
func (m *migration) createNotifier(c *notificationChannel) (*PostableGrafanaReceiver, error) {
|
||||
uid, err := m.generateChannelUID()
|
||||
uid := c.Uid
|
||||
if uid == "" {
|
||||
new, err := m.generateChannelUID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m.mg.Logger.Info("Legacy notification had an empty uid, generating a new one", "id", c.ID, "uid", new)
|
||||
uid = new
|
||||
}
|
||||
if _, seen := m.seenChannelUIDs[uid]; seen {
|
||||
new, err := m.generateChannelUID()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m.mg.Logger.Warn("Legacy notification had a UID that collides with a migrated record, generating a new one", "id", c.ID, "old", uid, "new", new)
|
||||
uid = new
|
||||
}
|
||||
|
||||
settings, secureSettings, err := migrateSettingsToSecureSettings(c.Type, c.Settings, c.SecureSettings)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue