From 8b10a320884fcb129874580db15f734e97ebd7bf Mon Sep 17 00:00:00 2001 From: Sjors Holtrop Date: Tue, 14 Jan 2025 12:22:21 +0100 Subject: [PATCH] Improve "flux resume" error message on non-existent object Signed-off-by: Sjors Holtrop --- cmd/flux/resume.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/flux/resume.go b/cmd/flux/resume.go index 5f3c8b8145..3c686064b2 100644 --- a/cmd/flux/resume.go +++ b/cmd/flux/resume.go @@ -151,6 +151,11 @@ func (resume *resumeCommand) getPatchedResumables(ctx context.Context, args []st } processed[arg] = struct{}{} + if resume.list.len() == 0 { + logger.Failuref("%s object '%s' not found in %s namespace", resume.kind, arg, resume.namespace) + continue + } + objs, err := resume.patch(ctx, []client.ListOption{ client.InNamespace(resume.namespace), client.MatchingFields{ @@ -174,11 +179,6 @@ func (resume resumeCommand) patch(ctx context.Context, listOpts []client.ListOpt return nil, err } - if resume.list.len() == 0 { - logger.Failuref("no %s objects found in %s namespace", resume.kind, resume.namespace) - return nil, nil - } - var resumables []resumable for i := 0; i < resume.list.len(); i++ {