dalen / puppet-puppetdbquery

Query functions for PuppetDB
Apache License 2.0
198 stars 71 forks source link

undefined method facts_query on puppetdb 6 #121

Closed whiphubley closed 5 years ago

whiphubley commented 5 years ago

When calling query_facts against puppetdb 6 I can see the connection on port 8081 with tcpdump but get the following error:

Error while evaluating a Function Call, undefined method facts_query for #<PuppetDB::Parser:0x6bab009>

Which seems to relate to the following code in the query_facts function:

parser = PuppetDB::Parser.new query = parser.facts_query query, facts_for_query if query.is_a? String parser.facts_hash(puppetdb.query(:facts, query, :extract => [:certname, :name, :value]), facts)

We use this module along with the jtopjian sshkeys module but something has broke since moving to puppet 6. We have updated both modules and am not aware of any other combination that can deploy ssh keys from puppetdb. Any help would be greatly appreciated.

whiphubley commented 5 years ago

OK it seems all is well and that error is shown if the sshpubkey_username fact is not yet available in the puppetdb. Once available it all works fine.