From 4e9abfd7d3226e44514ef9b053a840d33fc11ed9 Mon Sep 17 00:00:00 2001 From: Philipp Winter Date: Mon, 11 May 2026 13:04:59 -0500 Subject: [PATCH] Fix incorrect "not found" error check. So far, the command line parsing code would check the error returned by `FetchAndUnDecorateMatchableAttr` for a gRPC "not found" error but `AdminFetcherExtClient` maps this gRPC code to an internal `NotFoundError` type: It is this error that we need to check for. This PR adapts the error check, which unbreaks config file generation. (While at it, I also added a missing '\n' to a log message.) Signed-off-by: Philipp Winter --- .../config/subcommand/matchable_attr_file_config_utils.go | 2 +- flytectl/cmd/get/matchable_workflow_execution_config.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/flytectl/cmd/config/subcommand/matchable_attr_file_config_utils.go b/flytectl/cmd/config/subcommand/matchable_attr_file_config_utils.go index cb573fda223..e160868f241 100644 --- a/flytectl/cmd/config/subcommand/matchable_attr_file_config_utils.go +++ b/flytectl/cmd/config/subcommand/matchable_attr_file_config_utils.go @@ -52,7 +52,7 @@ func DumpTaskResourceAttr(matchableAttrConfig interface{}, fileName string) erro if err := WriteConfigToFile(matchableAttrConfig, fileName); err != nil { return fmt.Errorf("error dumping in file due to %v", err) } - fmt.Printf("wrote the config to file %v", fileName) + fmt.Printf("wrote the config to file %v\n", fileName) } else { fmt.Printf("%v", String(matchableAttrConfig)) } diff --git a/flytectl/cmd/get/matchable_workflow_execution_config.go b/flytectl/cmd/get/matchable_workflow_execution_config.go index e9bd44a8cf7..76a18ac0be7 100644 --- a/flytectl/cmd/get/matchable_workflow_execution_config.go +++ b/flytectl/cmd/get/matchable_workflow_execution_config.go @@ -8,10 +8,9 @@ import ( sconfig "github.com/flyteorg/flyte/flytectl/cmd/config/subcommand" "github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/workflowexecutionconfig" cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core" + "github.com/flyteorg/flyte/flytectl/pkg/ext" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin" "github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) const ( @@ -141,7 +140,7 @@ func getWorkflowExecutionConfigFunc(ctx context.Context, args []string, cmdCtx c // Updates the workflowExecutionConfigFileConfig with the fetched matchable attribute if err := FetchAndUnDecorateMatchableAttr(ctx, project, domain, workflowName, cmdCtx.AdminFetcherExt(), &workflowExecutionConfigFileConfig, admin.MatchableResource_WORKFLOW_EXECUTION_CONFIG); err != nil { - if grpcError := status.Code(err); grpcError == codes.NotFound && workflowexecutionconfig.DefaultFetchConfig.Gen { + if ext.IsNotFoundError(err) && workflowexecutionconfig.DefaultFetchConfig.Gen { fmt.Println("Generating a sample workflow execution config file") workflowExecutionConfigFileConfig = getSampleWorkflowExecutionFileConfig(project, domain, workflowName) } else {