Skip to content

Commit 4e9abfd

Browse files
Philipp WinterSovietaced
authored andcommitted
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 <philipp.winter@tiledb.com>
1 parent 1254e05 commit 4e9abfd

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

flytectl/cmd/config/subcommand/matchable_attr_file_config_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func DumpTaskResourceAttr(matchableAttrConfig interface{}, fileName string) erro
5252
if err := WriteConfigToFile(matchableAttrConfig, fileName); err != nil {
5353
return fmt.Errorf("error dumping in file due to %v", err)
5454
}
55-
fmt.Printf("wrote the config to file %v", fileName)
55+
fmt.Printf("wrote the config to file %v\n", fileName)
5656
} else {
5757
fmt.Printf("%v", String(matchableAttrConfig))
5858
}

flytectl/cmd/get/matchable_workflow_execution_config.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ import (
88
sconfig "github.com/flyteorg/flyte/flytectl/cmd/config/subcommand"
99
"github.com/flyteorg/flyte/flytectl/cmd/config/subcommand/workflowexecutionconfig"
1010
cmdCore "github.com/flyteorg/flyte/flytectl/cmd/core"
11+
"github.com/flyteorg/flyte/flytectl/pkg/ext"
1112
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/admin"
1213
"github.com/flyteorg/flyte/flyteidl/gen/pb-go/flyteidl/core"
13-
"google.golang.org/grpc/codes"
14-
"google.golang.org/grpc/status"
1514
)
1615

1716
const (
@@ -141,7 +140,7 @@ func getWorkflowExecutionConfigFunc(ctx context.Context, args []string, cmdCtx c
141140
// Updates the workflowExecutionConfigFileConfig with the fetched matchable attribute
142141
if err := FetchAndUnDecorateMatchableAttr(ctx, project, domain, workflowName, cmdCtx.AdminFetcherExt(),
143142
&workflowExecutionConfigFileConfig, admin.MatchableResource_WORKFLOW_EXECUTION_CONFIG); err != nil {
144-
if grpcError := status.Code(err); grpcError == codes.NotFound && workflowexecutionconfig.DefaultFetchConfig.Gen {
143+
if ext.IsNotFoundError(err) && workflowexecutionconfig.DefaultFetchConfig.Gen {
145144
fmt.Println("Generating a sample workflow execution config file")
146145
workflowExecutionConfigFileConfig = getSampleWorkflowExecutionFileConfig(project, domain, workflowName)
147146
} else {

0 commit comments

Comments
 (0)