puppetlabs/hiera — pull request #181 by Sharpie (2014-02-18 18:39:39+00:00)
Title: (HI-115) Fix regression in repeated lookups

PR #152 introduced a regression into Hiera 1.3.0 whereby the following use case is falsely flagged as an interpolation loop ([HI-115][HI-115])

interpolate %{this} and %{this} again

This occurs because the new `Hiera::Interpolate.interpolate` method re-scans the entire input string on each iteration and uses only one instance of `Hiera::RecursiveGuard`.

This patch adds a test for the above situation and restores the pre-1.3.0 behavior of using `gsub(pattern) {|match| block}` to drive interpolation. This method processes each interpolation site in isolation with a separate recursion guard.

Additionally, this level of isolation will be required for future improvements such as escaped interpolation ([HI-127][HI-127]).

[HI-115]: https://tickets.puppetlabs.com/browse/HI-115
[HI-127]: https://tickets.puppetlabs.com/browse/HI-127