mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-10 17:48:25 +08:00
fix: fix extclient creation and ACL migration (#2831)
This commit is contained in:
parent
0638dcac49
commit
b79a457ce2
2 changed files with 6 additions and 4 deletions
|
@ -430,14 +430,14 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
|||
extclient.Enabled = parentNetwork.DefaultACL == "yes"
|
||||
}
|
||||
|
||||
if err := logic.SetClientDefaultACLs(&extclient); err != nil {
|
||||
slog.Error("failed to set default acls for extclient", "user", r.Header.Get("user"), "network", node.Network, "error", err)
|
||||
if err = logic.CreateExtClient(&extclient); err != nil {
|
||||
slog.Error("failed to create extclient", "user", r.Header.Get("user"), "network", node.Network, "error", err)
|
||||
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
|
||||
return
|
||||
}
|
||||
|
||||
if err = logic.CreateExtClient(&extclient); err != nil {
|
||||
slog.Error("failed to create extclient", "user", r.Header.Get("user"), "network", node.Network, "error", err)
|
||||
if err := logic.SetClientDefaultACLs(&extclient); err != nil {
|
||||
slog.Error("failed to set default acls for extclient", "user", r.Header.Get("user"), "network", node.Network, "error", err)
|
||||
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
|
||||
return
|
||||
}
|
||||
|
|
|
@ -284,9 +284,11 @@ func updateAcls() {
|
|||
}
|
||||
|
||||
// save new acls
|
||||
slog.Info(fmt.Sprintf("(migration) saving new acls for network: %s", network.NetID), "networkAcl", networkAcl)
|
||||
if _, err := networkAcl.Save(acls.ContainerID(network.NetID)); err != nil {
|
||||
slog.Error(fmt.Sprintf("error during acls migration. error saving new acls for network: %s", network.NetID), "error", err)
|
||||
continue
|
||||
}
|
||||
slog.Info(fmt.Sprintf("(migration) successfully saved new acls for network: %s", network.NetID))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue