Skip to content

Commit

Permalink
Merge pull request #157 from stgraber/rebuild
Browse files Browse the repository at this point in the history
cmd/incusd: Properly forward rebuild requests
  • Loading branch information
hallyn authored Oct 11, 2023
2 parents 5f30d76 + e795d0f commit 73ea4db
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/incusd/instance_rebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,21 @@ func instanceRebuildPost(d *Daemon, r *http.Request) response.Response {
return response.BadRequest(fmt.Errorf("Invalid instance name"))
}

instanceType, err := urlInstanceTypeDetect(r)
if err != nil {
return response.SmartError(err)
}

// Handle requests targeted to a container on a different node
resp, err := forwardedResponseIfInstanceIsRemote(s, r, targetProjectName, name, instanceType)
if err != nil {
return response.SmartError(err)
}

if resp != nil {
return resp
}

// Parse the request
req := api.InstanceRebuildPost{}
err = json.NewDecoder(r.Body).Decode(&req)
Expand Down

0 comments on commit 73ea4db

Please sign in to comment.