From 405d6724fce1c27682d7dac61f23579d119e1327 Mon Sep 17 00:00:00 2001 From: rabi Date: Thu, 12 Sep 2024 09:23:41 +0530 Subject: [PATCH] Return error when IPSet not found We now use IPAM by default and if there are IPSet for a node missing we should return an error rather than ignoring it. Signed-off-by: rabi --- pkg/dataplane/inventory.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/dataplane/inventory.go b/pkg/dataplane/inventory.go index b8a4fecab..4fe8bab1d 100644 --- a/pkg/dataplane/inventory.go +++ b/pkg/dataplane/inventory.go @@ -153,15 +153,16 @@ func GenerateNodeSetInventory(ctx context.Context, helper *helper.Helper, err = resolveHostAnsibleVars(&node, &host) if err != nil { - utils.LogErrorForObject(helper, err, "Could not resolve ansible host vars", instance) + utils.LogErrorForObject(helper, err, "could not resolve ansible host vars", instance) return "", err } ipSet, ok := allIPSets[node.HostName] - if ok { - populateInventoryFromIPAM(&ipSet, host, dnsAddresses, node.HostName) + if !ok { + err := fmt.Errorf("no IPSet found for host: %s", node.HostName) + return "", err } - + populateInventoryFromIPAM(&ipSet, host, dnsAddresses, node.HostName) } invData, err := inventory.MarshalYAML()