mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-08 22:24:17 +08:00
keep all values when updating extcient name
This commit is contained in:
parent
60e340cf1b
commit
72ff3fe033
1 changed files with 17 additions and 1 deletions
|
@ -194,9 +194,25 @@ func UpdateExtClient(newclientid string, network string, enabled bool, client *m
|
|||
if err != nil {
|
||||
return client, err
|
||||
}
|
||||
if newclientid != client.ClientID {
|
||||
//name change only
|
||||
client.ClientID = newclientid
|
||||
client.LastModified = time.Now().Unix()
|
||||
data, err := json.Marshal(&client)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
key, err := GetRecordKey(client.ClientID, client.Network)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = database.Insert(key, string(data), database.EXT_CLIENT_TABLE_NAME); err != nil {
|
||||
return client, err
|
||||
}
|
||||
return client, nil
|
||||
}
|
||||
client.ClientID = newclientid
|
||||
client.Enabled = enabled
|
||||
client.PublicKey = ""
|
||||
SetClientACLs(client, newACLs)
|
||||
if err = CreateExtClient(client); err != nil {
|
||||
return client, err
|
||||
|
|
Loading…
Add table
Reference in a new issue