dalen / puppet-puppetdbquery

Query functions for PuppetDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

query report_timestamp from cli not working

jimr6007 opened this issue · comments

puppet query nodes '#node.report_timestamp < @"2 hours ago"' --debug

gives the following ....

Debug: /File[/etc/puppetlabs/code/environments/production]: Adding autorequire relationship with File[/etc/puppetlabs/code]
Debug: Finishing transaction 37459200
Debug: #PuppetDB::Connection:0x00000002e56e90: PuppetDB query: ["extract",["certname"],["in","certname",["extract","certname",["select_nodes",["<","report_timestamp","2015-12-14T03:43:12+00:00"]]]]]
Debug: Creating new connection for https://puppet.nym1.placeiq.net:8081

so that looks fine but I actually get zero results when I should get 5 nodes returned.

One reason I know I should see 5 nodes returned is because this:

node.report_timestamp<@"now - 2 hours"

via Puppet Explorer, returns 5 nodes, as expected.

I stopped my pupperserver and with just puppetdb running and puppetdb's logging set to debug, I tried this query again and the results of that are attached.

Can you tell by looking at that if something is getting "lost in translation"?

puppetdb.log.txt

It seems like new versions of PuppetDB only handles dates where timezone is specified as Z, not +00:00 which ISO-8601 also allows. This is likely a upstream regression. But I fixed so puppetdbquery emits datetimes in that format instead and released 2.1.1 with the fix.

works...
awesome, thanks !!