|
The node_state query parameter introduced as part of
PDB-3420
causes an error when used as part of a conditional in a PQL query.
Reproduction Case
-
Install a PE 2017.3.2 all-in-one master.
-
Generate a test certname, populate data for it in PuppetDB, then deactivate it:
/opt/puppetlabs/bin/puppet cert generate node-state-query.test
|
|
/opt/puppetlabs/bin/puppet agent -t --noop --certname node-state-query.test
|
|
/opt/puppetlabs/bin/puppet node deactivate node-state-query.test
|
-
Query PuppetDB for data from the inactive node:
puppet query 'nodes { certname = "deactivation.test" and node_state = "any" }'
|
Outcome
The query fails with a parsing error:
# /opt/puppetlabs/bin/puppet query 'nodes { certname = "deactivation.test" and node_state = "any" }'
|
Error response 400 Bad Request from server: [] is not well-formed: queries must contain at least one operator
|
Expected Outcome
The query returns node data for the deactivated node that matches the output from a query that does not use a conditional:
# /opt/puppetlabs/bin/puppet query 'nodes { node_state = "inactive" }'
|
[
|
{
|
"deactivated": "2018-01-17T17:11:34.384Z",
|
"latest_report_hash": "035dce81729336f76f784239a655f4e2603a309e",
|
"facts_environment": "production",
|
"cached_catalog_status": "not_used",
|
"report_environment": "production",
|
"latest_report_corrective_change": false,
|
"catalog_environment": "production",
|
"facts_timestamp": "2018-01-17T17:11:30.581Z",
|
"latest_report_noop": true,
|
"expired": null,
|
"latest_report_noop_pending": true,
|
"report_timestamp": "2018-01-17T17:11:28.127Z",
|
"certname": "node-state-query.test",
|
"catalog_timestamp": "2018-01-17T17:11:31.526Z",
|
"latest_report_status": "unchanged"
|
}
|
]
|
|