From fbb6f2ad753f1cfc3df1f3504164b36ab1e9d6b2 Mon Sep 17 00:00:00 2001 From: haitham911 Date: Sun, 17 Nov 2024 12:42:42 +0200 Subject: [PATCH] fix: handle empty stack YAML configuration and adjust file content retrieval --- examples/demo-localstack/stacks/deploy/footbar.yaml | 0 internal/exec/stack_processor_utils.go | 6 +++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 examples/demo-localstack/stacks/deploy/footbar.yaml diff --git a/examples/demo-localstack/stacks/deploy/footbar.yaml b/examples/demo-localstack/stacks/deploy/footbar.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/internal/exec/stack_processor_utils.go b/internal/exec/stack_processor_utils.go index b6c6f4d0e..6b22b0ad5 100644 --- a/internal/exec/stack_processor_utils.go +++ b/internal/exec/stack_processor_utils.go @@ -199,6 +199,10 @@ func ProcessYAMLConfigFile( return nil, nil, nil, err } } + if stackYamlConfig == "" { + return map[string]any{}, map[string]map[string]any{}, map[string]any{}, nil + + } stackManifestTemplatesProcessed := stackYamlConfig stackManifestTemplatesErrorMessage := "" @@ -1874,7 +1878,7 @@ func CreateComponentStackMap( func GetFileContent(filePath string) (string, error) { existingContent, found := getFileContentSyncMap.Load(filePath) if found && existingContent != nil { - return fmt.Sprintf("%s", existingContent), nil + return "", nil } content, err := os.ReadFile(filePath)