Skip to content

Commit

Permalink
insightsclient uses a provided architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
joselsegura committed Aug 16, 2024
1 parent 8024649 commit 2e450dd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash

RED='\033[0;31m'
GREEN='\033[0;32m'
Expand Down
2 changes: 1 addition & 1 deletion pkg/insights/insightsclient/insightsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
const (
responseBodyLogLen = 1024
insightsReqId = "x-rh-insights-request-id"
scaArchPayload = `{"type": "sca","arch": "x86_64"}`
scaArchPayload = `{"type": "sca","arch": "%s"}`
)

type Client struct {
Expand Down
5 changes: 3 additions & 2 deletions pkg/insights/insightsclient/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (c *Client) RecvReport(ctx context.Context, endpoint string) (*http.Respons
return nil, fmt.Errorf("report response status code: %d", resp.StatusCode)
}

func (c *Client) RecvSCACerts(_ context.Context, endpoint string) ([]byte, error) {
func (c *Client) RecvSCACerts(_ context.Context, endpoint string, architecture string) ([]byte, error) {
cv, err := c.GetClusterVersion()
if apierrors.IsNotFound(err) {
return nil, ErrWaitingForVersion
Expand All @@ -192,7 +192,8 @@ func (c *Client) RecvSCACerts(_ context.Context, endpoint string) ([]byte, error
if err != nil {
return nil, err
}
req, err := http.NewRequest(http.MethodPost, endpoint, bytes.NewBuffer([]byte(scaArchPayload)))
payload := fmt.Sprintf(scaArchPayload, architecture)
req, err := http.NewRequest(http.MethodPost, endpoint, bytes.NewBuffer([]byte(payload)))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/ocm/sca/sca.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func (c *Controller) requestSCAWithExpBackoff(endpoint string) ([]byte, error) {
var data []byte
err := wait.ExponentialBackoff(bo, func() (bool, error) {
var err error
data, err = c.client.RecvSCACerts(c.ctx, endpoint)
data, err = c.client.RecvSCACerts(c.ctx, endpoint, "x86_64")
if err != nil {
// don't try again in case it's not an HTTP error - it could mean we're in disconnected env
if !insightsclient.IsHttpError(err) {
Expand Down

0 comments on commit 2e450dd

Please sign in to comment.