From 0a304f659d43d162c1e64787a5bebb74d8977aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Thu, 19 Nov 2020 11:41:07 +0100 Subject: [PATCH] worker/client: pass arch explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API client guessed the arch, let's pass it explicitly so a caller can specify it. Signed-off-by: Ondřej Budai --- cmd/osbuild-worker/main.go | 3 ++- internal/worker/client.go | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/osbuild-worker/main.go b/cmd/osbuild-worker/main.go index 310952b0e..61a15ff60 100644 --- a/cmd/osbuild-worker/main.go +++ b/cmd/osbuild-worker/main.go @@ -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) } diff --git a/internal/worker/client.go b/internal/worker/client.go index 0337b7859..be1856a28 100644 --- a/internal/worker/client.go +++ b/internal/worker/client.go @@ -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)