Skip to content

Commit

Permalink
fix(parser): do not break if a non-intrinsic Condition statement is…
Browse files Browse the repository at this point in the history
… found in a YAML template (awslabs#169)
  • Loading branch information
Graham Jenson authored and PaulMaddox committed Mar 10, 2019
1 parent fb9bb65 commit e4671e3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions intrinsics/intrinsics.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,10 @@ func search(input interface{}, template interface{}, options *ProcessorOptions)
if key == "Condition" {
// This can lead to infinite recursion A -> B; B -> A;
// pass state of the conditions that we're evaluating so we can detect cycles
// in case of cycle, return nil
return condition(key, search(val, template, options), template, options)
// in case of cycle or not found, do nothing
if con := condition(key, search(val, template, options), template, options); con != nil {
return con
}
}

// This is not an intrinsic function, recurse through it normally
Expand Down

0 comments on commit e4671e3

Please sign in to comment.