Skip to content

Commit

Permalink
Restore documented puppetdb_query BoltSpec mocking
Browse files Browse the repository at this point in the history
The documented (and previous to PR #3092 working) puppetdb_client
mocking expected only a single value to the function (the query).
This change restores that behavior.

!bug

* Restore documented BoltSpec puppetdb_query mocking behavior
  • Loading branch information
seanmil committed Jul 21, 2023
1 parent a308978 commit f203b4f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,21 @@
# The query type could be more specific ASTQuery = Array[Variant[String, ASTQuery]]

def make_query(query)
make_query_with_instance(query, nil)
puppetdb_client.make_query(query)
end

def make_query_with_instance(query, instance)
puppetdb_client.make_query(query, nil, instance)
end

private

def puppetdb_client
puppetdb_client = Puppet.lookup(:bolt_pdb_client)
# Bolt executor not expected when invoked from apply block
executor = Puppet.lookup(:bolt_executor) { nil }
# Send Analytics Report
executor&.report_function_call(self.class.name)

puppetdb_client.make_query(query, nil, instance)
puppetdb_client
end
end

0 comments on commit f203b4f

Please sign in to comment.