Update internal/maa/patch.go

Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com>
This commit is contained in:
Moritz Sanft 2024-06-07 13:56:57 +02:00 committed by GitHub
parent 887587ba62
commit 65f34103a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,11 +59,8 @@ func (p AzurePolicyPatcher) Patch(ctx context.Context, attestationURL string) er
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
body, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("updating attestation policy: unexpected status code: %s\nread response body: %w", resp.Status, err)
}
return fmt.Errorf("updating attestation policy: unexpected status code: %s\nresponse body: %s", resp.Status, string(body))
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("updating attestation policy: unexpected status code: %s: %s", resp.Status, string(body))
}
return nil