Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Varied bugfixes #934

Merged
merged 10 commits into from
Jun 12, 2024
13 changes: 13 additions & 0 deletions cmd/incusd/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,19 @@ func networksPost(d *Daemon, r *http.Request) response.Response {
return response.SmartError(err)
}

n, err := network.LoadByName(s, projectName, req.Name)
if err != nil {
return response.SmartError(fmt.Errorf("Failed loading network: %w", err))
}

err = s.Authorizer.AddNetwork(r.Context(), projectName, req.Name)
if err != nil {
logger.Error("Failed to add network to authorizer", logger.Ctx{"name": req.Name, "project": projectName, "error": err})
hallyn marked this conversation as resolved.
Show resolved Hide resolved
}

requestor := request.CreateRequestor(r)
s.Events.SendLifecycle(projectName, lifecycle.NetworkCreated.Event(n, requestor, nil))

return resp
}

Expand Down