Skip to content

Commit

Permalink
fix(api): missing group for template when loaded from audit (#5273)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt authored Jun 23, 2020
1 parent c51b3b3 commit 511cb03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion engine/api/workflow/dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ func checkApplication(db gorp.SqlExecutor, proj sdk.Project, w *sdk.Workflow, n
appDB, err := application.LoadByName(db, proj.Key, n.Context.ApplicationName, application.LoadOptions.WithDeploymentStrategies, application.LoadOptions.WithVariables)
if err != nil {
if sdk.ErrorIs(err, sdk.ErrNotFound) {
return sdk.WithData(sdk.ErrNotFound, n.Context.ApplicationName)
return sdk.NewErrorFrom(sdk.WithData(sdk.ErrNotFound, n.Context.ApplicationName), "cannot find application with name: %s", n.Context.ApplicationName)
}
return sdk.WrapError(err, "unable to load application %s", n.Context.ApplicationName)
}
Expand Down
6 changes: 4 additions & 2 deletions engine/api/workflowtemplate/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func CheckAndExecuteTemplate(ctx context.Context, db *gorp.DbMap, consumer sdk.A
return allMsgs, nil, sdk.NewErrorFrom(sdk.ErrWrongRequest, "could not find given workflow template")
}

wt, err := LoadBySlugAndGroupID(ctx, db, templateSlug, grp.ID, LoadOptions.Default)
wt, err := LoadBySlugAndGroupID(ctx, db, templateSlug, grp.ID)
if err != nil {
return allMsgs, nil, sdk.NewErrorFrom(err, "could not find a template with slug %s in group %s", templateSlug, grp.Name)
}
Expand All @@ -160,7 +160,9 @@ func CheckAndExecuteTemplate(ctx context.Context, db *gorp.DbMap, consumer sdk.A
}
wt = &wta.DataAfter
}

if err := LoadOptions.Default(ctx, db, wt); err != nil {
return allMsgs, nil, err
}
allMsgs = append(allMsgs, sdk.NewMessage(sdk.MsgWorkflowGeneratedFromTemplateVersion, wt.PathWithVersion()))

req := sdk.WorkflowTemplateRequest{
Expand Down

0 comments on commit 511cb03

Please sign in to comment.