ignition/packet-fix-metadata-fetch.patch
2020-03-28 10:13:49 -04:00

34 lines
1.2 KiB
Diff

From 4c2dcd547b01b2f13ced8d35263ded5fd67fa645 Mon Sep 17 00:00:00 2001
From: Benjamin Gilbert <bgilbert@redhat.com>
Date: Sat, 28 Mar 2020 01:15:32 -0400
Subject: [PATCH 2/2] providers/packet: override Accept header fetching
instance metadata
Passing nil Headers is no longer sufficient to avoid the default Accept
header; we need to override it. Fixes 406 Not Acceptable error.
Fixes: 75d3e2da74ae ("Rework fetch/resource to automatically append required headers")
---
internal/providers/packet/packet.go | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/internal/providers/packet/packet.go b/internal/providers/packet/packet.go
index 8771734..613a6ba 100644
--- a/internal/providers/packet/packet.go
+++ b/internal/providers/packet/packet.go
@@ -71,8 +71,10 @@ func FetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) {
func PostStatus(stageName string, f resource.Fetcher, errMsg error) error {
f.Logger.Info("POST message to Packet Timeline")
// fetch JSON from https://metadata.packet.net/metadata
+ headers := make(http.Header)
+ headers.Set("Accept", "*/*")
data, err := f.FetchToBuffer(metadataUrl, resource.FetchOptions{
- Headers: nil,
+ Headers: headers,
})
if err != nil {
return err
--
2.24.1