Query page PQL raw does not match puppetdb_query output
jgrammen-agilitypr opened this issue · 2 comments
The raw output in puppetboard does not produce output that matches the value from puppetdb_query.
Perhaps a toggle or flag could be added that produces output consistent with puppetdb_query. If I run a pql query in the dashboard I would expect the same query in puppetdb_query to return the same output.
pql endpoint query with raw checked:
inventory[certname, facts.ec2_metadata.network.interfaces.macs, facts.macaddress] { certname='host01.agilitypr.internal' or certname='host01.internal'}
output
[
[
"host1.internal",
{
"11:aa:11:aa:11:aa": {
"device-number": "0",
"interface-id": "eni-aa888888888880000",
"local-hostname": "ip-10-10-10-10.internal a.internal b.internal",
"local-ipv4s": "10.10.10.10",
"mac": "11:aa:11:aa:11:aa",
"owner-id": "123451234123",
"security-group-ids": "sg-asdf12341233544123",
"security-groups": "CA04V150-haproxy",
"subnet-id": "subnet-0asdf09098877",
"subnet-ipv4-cidr-block": "10.10.10.0/24",
"vpc-id": "vpc-asdfasdf",
"vpc-ipv4-cidr-block": "10.10.0.0/16",
"vpc-ipv4-cidr-blocks": "10.10.0.0/16"
}
},
"11:aa:11:aa:11:aa"
],
[
"host2.internal",
{
"22:bb:22:bb:22:bb": {
"device-number": "0",
"interface-id": "eni-11211100000000012",
"local-hostname": "ip-10-10-10-8.internal a.internal b.internal",
"local-ipv4s": "10.10.10.9\n10.10.10.8",
"mac": "22:bb:22:bb:22:bb",
"owner-id": "123451234123",
"security-group-ids": "sg-asdf12341233544123",
"security-groups": "CA04V150-haproxy",
"subnet-id": "subnet-0asdf09098877",
"subnet-ipv4-cidr-block": "10.10.10..0/24",
"vpc-id": "vpc-asdfasdf",
"vpc-ipv4-cidr-block": "10.10.0.0/16",
"vpc-ipv4-cidr-blocks": "10.10.0.0/16"
}
},
"22:bb:22:bb:22:bb"
]
]
output from puppetdb_query
[
{
certname => host2.internal,
facts.ec2_metadata.network.interfaces.macs => {
22:bb:22:bb:22:bb => {
mac => 22:bb:22:bb:22:bb,
vpc-id => vpc-asdfasdf",
owner-id => 123451234123,
subnet-id => subnet-0asdf09098877,
local-ipv4s => 10.10.10.9,
interface-id => eni-11211100000000012,
device-number => 0,
local-hostname => ip-10-10-10-8.internal a.internal b.internal,
security-groups => CA04V150-haproxy,
security-group-ids => sg-asdf12341233544123,
vpc-ipv4-cidr-block => 10.10.0.0/16,
vpc-ipv4-cidr-blocks => 10.10.0.0/16,
subnet-ipv4-cidr-block => 10.10.10.0/24
}
},
facts.macaddress => 22:bb:22:bb:22:bb
},
{
certname => host1.internal,
facts.ec2_metadata.network.interfaces.macs =>{
11:aa:11:aa:11:aa => {
mac => 11:aa:11:aa:11:aa,
vpc-id => vpc-asdfasdf,
owner-id => 123451234123,
subnet-id => subnet-0asdf09098877,
local-ipv4s => 10.10.10.9\n10.10.10.8,
interface-id => eni-aa888888888880000,
device-number => 0,
local-hostname => ip-10-10-10-10.internal a.internal b.internal,
security-groups => CA04V150-haproxy,
security-group-ids => sg-asdf12341233544123,
vpc-ipv4-cidr-block => 10.10.0.0/16,
vpc-ipv4-cidr-blocks => 10.10.0.0/16,
subnet-ipv4-cidr-block => 10.10.10.0/24
}
},
facts.macaddress => 11:aa:11:aa:11:aa
}
]
now granted puppetdb query doesn't produce json, but the schema/layout of the data is completely different, as the puppetdb_query has key value pairs. With keys being the field names listed in the pql query
It would be nice if puppetboard has a way of showing the actual output that puppetdb_query would produce, as I had a very frustrating debugging sessions when i used the puppetboard raw output as mock data, only to realize that it doesn't match the puppetdb_query output.
Hi @jgrammen-agilitypr! Thanks for reporting this.
You are right, when implementing #654 I did the change that the query results are split into columns and rows for the purpose of showing the results as a table. However back then we also started to show only the rows as the response in the JSON view...
I have already prepared a fix this, see the linked PR. :)