worker/client: pass arch explicitly
The API client guessed the arch, let's pass it explicitly so a caller can specify it. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
8fa822c02e
commit
0a304f659d
2 changed files with 5 additions and 4 deletions
|
|
@ -15,6 +15,7 @@ import (
|
|||
|
||||
"github.com/BurntSushi/toml"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/upload/azure"
|
||||
"github.com/osbuild/osbuild-composer/internal/upload/koji"
|
||||
"github.com/osbuild/osbuild-composer/internal/worker"
|
||||
|
|
@ -228,7 +229,7 @@ func main() {
|
|||
|
||||
for {
|
||||
fmt.Println("Waiting for a new job...")
|
||||
job, err := client.RequestJob(acceptedJobTypes)
|
||||
job, err := client.RequestJob(acceptedJobTypes, common.CurrentArch())
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/worker/api"
|
||||
)
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ func (c *Client) NewRequest(method, url string, body io.Reader) (*http.Request,
|
|||
return req, nil
|
||||
}
|
||||
|
||||
func (c *Client) RequestJob(types []string) (Job, error) {
|
||||
func (c *Client) RequestJob(types []string, arch string) (Job, error) {
|
||||
url, err := c.server.Parse("jobs")
|
||||
if err != nil {
|
||||
// This only happens when "jobs" cannot be parsed.
|
||||
|
|
@ -172,7 +172,7 @@ func (c *Client) RequestJob(types []string) (Job, error) {
|
|||
var buf bytes.Buffer
|
||||
err = json.NewEncoder(&buf).Encode(api.RequestJobJSONRequestBody{
|
||||
Types: types,
|
||||
Arch: common.CurrentArch(),
|
||||
Arch: arch,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue