From 6cbf57a44356d9b521bf9209c9748d8070f34c5d Mon Sep 17 00:00:00 2001 From: Mohamed Chiheb Ben Jemaa Date: Thu, 17 Oct 2024 15:56:48 +0200 Subject: [PATCH] Add check to ignore cloud-config --- internal/providers/ionoscloud/ionoscloud.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/providers/ionoscloud/ionoscloud.go b/internal/providers/ionoscloud/ionoscloud.go index fa8fd4c6a..906bc3d53 100644 --- a/internal/providers/ionoscloud/ionoscloud.go +++ b/internal/providers/ionoscloud/ionoscloud.go @@ -19,6 +19,7 @@ package ionoscloud import ( + "bytes" "os" "github.com/coreos/ignition/v2/config/v3_5_experimental/types" @@ -48,5 +49,12 @@ func fetchConfig(f *resource.Fetcher) (types.Config, report.Report, error) { f.Logger.Err("couldn't read config %q: %v", defaultFilename, err) return types.Config{}, report.Report{}, err } + + header := []byte("#cloud-config\n") + if bytes.HasPrefix(rawConfig, header) { + f.Logger.Debug("config drive (%q) contains a cloud-config configuration, ignoring", defaultFilename) + return types.Config{}, report.Report{}, err + } + return util.ParseConfig(f.Logger, rawConfig) }