Przeglądaj źródła

Merge pull request #3396 from gravitl/release-v0.30.0

add migration for extclient tags
Abhishek K 5 miesięcy temu
rodzic
commit
9b2bffe723
2 zmienionych plików z 10 dodań i 1 usunięć
  1. 7 0
      migrate/migrate.go
  2. 3 1
      models/extclient.go

+ 7 - 0
migrate/migrate.go

@@ -228,6 +228,13 @@ func updateNodes() {
 
 		}
 	}
+	extclients, _ := logic.GetAllExtClients()
+	for _, extclient := range extclients {
+		if extclient.Tags == nil {
+			extclient.Tags = make(map[models.TagID]struct{})
+			logic.SaveExtClient(&extclient)
+		}
+	}
 }
 
 func removeInterGw(egressRanges []string) ([]string, bool) {

+ 3 - 1
models/extclient.go

@@ -50,7 +50,9 @@ type CustomExtClient struct {
 }
 
 func (ext *ExtClient) ConvertToStaticNode() Node {
-
+	if ext.Tags == nil {
+		ext.Tags = make(map[TagID]struct{})
+	}
 	return Node{
 		CommonNode: CommonNode{
 			Network:  ext.Network,