Skip to content

Commit

Permalink
Merge pull request #1095 from jhrozek/misc
Browse files Browse the repository at this point in the history
Fix medev rule
  • Loading branch information
JAORMX authored Oct 4, 2023
2 parents 51d786d + 7a3f504 commit 3255461
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cmd/dev/app/rule_type/rule_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ func testCmdRun(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("error reading rule type from file: %w", err)
}

rootProject := "00000000-0000-0000-0000-000000000002"
rt.Context = &mediatorv1.Context{
Provider: "test",
Project: &rootProject,
}

ent, err := readEntityFromFile(epath.Value.String(), mediatorv1.EntityFromString(rt.Def.InEntity))
if err != nil {
return fmt.Errorf("error reading entity from file: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions internal/engine/rule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ func NewRuleTypeEngine(rt *mediatorv1.RuleType, cli *providers.ProviderBuilder)
org := strings.Clone(*rt.Context.Organization)
rte.Meta.Organization = &org
} else if rt.Context.Project != nil && *rt.Context.Project != "" {
grp := strings.Clone(*rt.Context.Project)
rte.Meta.Project = &grp
prj := strings.Clone(*rt.Context.Project)
rte.Meta.Project = &prj
} else {
return nil, fmt.Errorf("rule type context must have an organization or group")
return nil, fmt.Errorf("rule type context must have an organization or project")
}

return rte, nil
Expand Down

0 comments on commit 3255461

Please sign in to comment.