From f569227d2c477d5e06cb2df5ae6f8be4b3cdcf3b Mon Sep 17 00:00:00 2001 From: abraham2512 Date: Thu, 26 Sep 2024 12:17:43 -0400 Subject: [PATCH 1/2] ztp: checks for empty manifests in siteconfig-generator-kustomize-plugin --- .../siteConfig/siteConfigBuilder.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/ztp/siteconfig-generator/siteConfig/siteConfigBuilder.go b/ztp/siteconfig-generator/siteConfig/siteConfigBuilder.go index 4fd5b6c9b..d352ed846 100644 --- a/ztp/siteconfig-generator/siteConfig/siteConfigBuilder.go +++ b/ztp/siteconfig-generator/siteConfig/siteConfigBuilder.go @@ -601,7 +601,7 @@ func (scbuilder *SiteConfigBuilder) getExtraManifestMaps(roles map[string]bool, if err != nil { errStr := fmt.Sprintf("Error could not read WorkloadManifest %s %s\n", clusterSpec.ClusterName, err) return dataMap, doNotMerge, errors.New(errStr) - } else { + } else if v.(string) != "" { data, err := addZTPAnnotationToManifest(v.(string)) if err != nil { return dataMap, doNotMerge, err @@ -670,11 +670,13 @@ func (scbuilder *SiteConfigBuilder) getExtraManifest(dataMap map[string]interfac return dataMap, err } - manifestFileStr, err := addZTPAnnotationToManifest(string(manifestFile)) - if err != nil { - return dataMap, err + if len(manifestFile) != 0 { + manifestFileStr, err := addZTPAnnotationToManifest(string(manifestFile)) + if err != nil { + return dataMap, err + } + dataMap[file.Name()] = manifestFileStr } - dataMap[file.Name()] = manifestFileStr // user provided CRs don't need to be merged doNotMerge[file.Name()] = true From 9d236c69e4d9840b5bea27a8ef41b3e0d700b209 Mon Sep 17 00:00:00 2001 From: abraham2512 Date: Thu, 26 Sep 2024 12:18:44 -0400 Subject: [PATCH 2/2] ztp: adding empty file in testUserExtraManifest --- .../testSiteConfig/testUserExtraManifest/00-emptymanifest.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ztp/siteconfig-generator-kustomize-plugin/testSiteConfig/testUserExtraManifest/00-emptymanifest.yaml diff --git a/ztp/siteconfig-generator-kustomize-plugin/testSiteConfig/testUserExtraManifest/00-emptymanifest.yaml b/ztp/siteconfig-generator-kustomize-plugin/testSiteConfig/testUserExtraManifest/00-emptymanifest.yaml new file mode 100644 index 000000000..e69de29bb