From 6de8831a9d52502cbd768c7b768557edf2bd2d1f Mon Sep 17 00:00:00 2001 From: Dan Rammer Date: Wed, 30 Nov 2022 03:02:29 -0600 Subject: [PATCH] check deck uri exists before checking for datastore existance (#506) Signed-off-by: Dan Rammer Signed-off-by: Dan Rammer --- pkg/controller/nodes/executor.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pkg/controller/nodes/executor.go b/pkg/controller/nodes/executor.go index 58025c0c43..678f7e446c 100644 --- a/pkg/controller/nodes/executor.go +++ b/pkg/controller/nodes/executor.go @@ -264,14 +264,16 @@ func (c *nodeExecutor) attemptRecovery(ctx context.Context, nCtx handler.NodeExe } deckFile := storage.DataReference(recovered.Closure.GetDeckUri()) - metadata, err := nCtx.DataStore().Head(ctx, deckFile) - if err != nil { - logger.Errorf(ctx, "Failed to check the existence of deck file. Error: %v", err) - return handler.PhaseInfoUndefined, errors.Wrapf(errors.CausedByError, nCtx.NodeID(), err, "Failed to check the existence of deck file.") - } + if len(deckFile) > 0 { + metadata, err := nCtx.DataStore().Head(ctx, deckFile) + if err != nil { + logger.Errorf(ctx, "Failed to check the existence of deck file. Error: %v", err) + return handler.PhaseInfoUndefined, errors.Wrapf(errors.CausedByError, nCtx.NodeID(), err, "Failed to check the existence of deck file.") + } - if metadata.Exists() { - oi.DeckURI = &deckFile + if metadata.Exists() { + oi.DeckURI = &deckFile + } } if err := c.store.WriteProtobuf(ctx, outputFile, so, outputs); err != nil {