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

CCXDEV-14146: insightsclient support for requesting a specific architecture #981

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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