Skip to content

Commit

Permalink
Don't lookup lookup_options key
Browse files Browse the repository at this point in the history
Prevent recursive queries for `lookup_options`; idea stolen from
dalen#115.
  • Loading branch information
irregulator committed Jun 26, 2023
1 parent 34abdbc commit 4802d2d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/puppet/functions/puppetdb_lookup_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
def puppetdb_lookup_key(key, options, context)
return context.cached_value(key) if context.cache_has_key(key)

if key == "lookup_options"
context.not_found
end

if !key.end_with?('::_nodequery') && nodequery = call_function('lookup', "#{key}::_nodequery", 'merge' => 'first', 'default_value' => nil)
# Support specifying the query in a few different ways
query, fact, sort = case nodequery
Expand Down

0 comments on commit 4802d2d

Please sign in to comment.