dalen / puppet-puppetdbquery

Query functions for PuppetDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

puppet query facts error - error: [400] Unknown Version, query: null

vikas027 opened this issue · comments

I am using puppetserver v2.1.1 with puppetdb v3.1.0 (with postgresql backend) on a CentOS 7.1 server. Commands puppet query nodes and puppet query events is working fine but somehow puppet query facts throws below error. Not sure, if I am missing something.

I sought some help on IRC channel, and was advised by @kbarber that the URL is being constructed incorrectly. Please see this.

Please see below logs.

# puppet query nodes '(Package["vim"] and architecture=x86_64)'
box28.test.com
box32.test.com
# 
# puppet query events '(fqdn~"test.com" and Package["vim"] and architecture=x86_64)' --since='1 minute ago'
box28.test.com: 2015-10-14T11:17:37.108Z: Notify[Setting up basic OS Configurations]/message (absent -> Setting up basic OS Configurations): defined 'message' as 'Setting up basic OS Configurations'
box32.test.com: 2015-10-14T11:17:43.268Z: Notify[Setting up basic OS Configurations]/message (absent -> Setting up basic OS Configurations): defined 'message' as 'Setting up basic OS Configurations'
#

# puppet query facts '(fqdn~".*")' --facts osfamily,ipaddress,kernel
OR
# puppet query facts '(Package["vim"] and architecture=x86_64)'
Error: PuppetDB query error: [400] Unknown Version, query: null
Error: Try 'puppet help query facts' for usage
#

I have also tried to use it in a manifest as below, the error remains the same.

query_facts('Class[Dns]', ['osfamily', 'ipaddress'])

Database tables are populated well.

puppetdb=> select * from fact_values limit 2;
 id |                 value_hash                 | value_type_id | value_integer | value_float |              value_string               | value_boolean |                   value
----+--------------------------------------------+---------------+---------------+-------------+-----------------------------------------+---------------+-------------------------------------------
  1 | \x9d3ea577cd7f8ee06f6a60dca6d84b477ff2846d |             0 |               |             | 07/31/2013                              |               | "07/31/2013"
  2 | \xb7b08b770b277ec9042c222d2016751899c63805 |             0 |               |             | ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff |               | "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"
(2 rows)

puppetdb=>

@dalen confirmed on my localhost also, as per the linked gist, the url construction is messed up just for facts. the other ones: nodes & events aren't affected it would seem.

@dalen Thank you, puppet query facts is working as expected now.