From 13b80ca296513b8c75be63660fc124610e59f38a Mon Sep 17 00:00:00 2001 From: Aslak Knutsen Date: Wed, 4 Sep 2024 14:40:31 +0200 Subject: [PATCH] bug: avoid failing when not finding status expressions The status paths might not have been written at the time of first n executions and should only be retried on new reconcile attempts. --- pkg/spi/types.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/spi/types.go b/pkg/spi/types.go index 0f118a0..6e9c80f 100644 --- a/pkg/spi/types.go +++ b/pkg/spi/types.go @@ -94,7 +94,7 @@ func UnifiedHostExtractor(extractors ...HostExtractor) HostExtractor { //nolint: } func NewPathExpressionExtractor(paths []string) HostExtractor { - extractHosts := func(target *unstructured.Unstructured, splitPath []string) ([]string, error) { + extractHosts := func(target *unstructured.Unstructured, splitPath []string) ([]string, error) { //nolint:unparam //reason Part of HostExtractor interface // extracting as string if foundHost, found, err := unstructured.NestedString(target.Object, splitPath...); err == nil && found { return []string{foundHost}, nil @@ -105,7 +105,8 @@ func NewPathExpressionExtractor(paths []string) HostExtractor { return foundHosts, nil } - return nil, fmt.Errorf("neither string nor slice of strings found at path %v", splitPath) + // TODO: Nothing found yet, move on no error? + return []string{}, nil } return func(target *unstructured.Unstructured) ([]string, error) {