From d4c0213f607b05003c1753d12fa3cef8a8745781 Mon Sep 17 00:00:00 2001 From: Malte Poll Date: Wed, 19 Jul 2023 13:27:44 +0200 Subject: [PATCH] cli: allow manual patch of attestation policy --- cli/internal/cloudcmd/patch.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/internal/cloudcmd/patch.go b/cli/internal/cloudcmd/patch.go index a18138f07..29ff47ddb 100644 --- a/cli/internal/cloudcmd/patch.go +++ b/cli/internal/cloudcmd/patch.go @@ -6,6 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only package cloudcmd import ( + "bytes" "context" "encoding/base64" "fmt" @@ -55,10 +56,13 @@ func (p AzurePolicyPatcher) Patch(ctx context.Context, attestationURL string) er if err != nil { return fmt.Errorf("sending request: %w", err) } - resp.Body.Close() + defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return fmt.Errorf("updating attestation policy: unexpected status code: %s", resp.Status) + buf := new(bytes.Buffer) + _, _ = buf.ReadFrom(resp.Body) + fmt.Printf("updating attestation policy: unexpected status code: %s with message %q", resp.Status, buf.String()) + fmt.Println("Patching the attestations policy failed. Please patch the policy manually before continuing to initialize the cluster.") } return nil