[PDB-3930] PQL's ~ matches incorrectly on dotted variables Created: 2018/06/02  Updated: 2018/09/13  Resolved: 2018/07/11

Status: Closed
Project: PuppetDB
Component/s: None
Affects Version/s: PDB 5.2.2
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Daniel Parks Assignee: Rob Browning
Resolution: Fixed Votes: 1
Labels: customer0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


Issue Links:
duplicates PDB-3903 PQL ~ operator matches empty strings ... Closed
relates to ENTERPRISE-1183 Console classification regex behaving... Resolved
Acceptance Criteria:

The following query returns records:

resources { type = 'File' and parameters.ensure ~ '^file$' }

Team: PuppetDB
Method Found: Needs Assessment
CS Priority: Reviewed
CS Frequency: 3 - 25-50% of Customers
CS Severity: 3 - Serious
CS Business Value: 4 - $$$$$
CS Impact: CS Triage feedback on this issue replicated from: PE-24298.

Although this does not affect classification, it would cause confusion in our customer base. It will lead to customers going down rabbit holes when attempting to debug classification issues which will lead to at least frustration if not a support call.
Release Notes: Bug Fix
Release Notes Summary: PuppetDB should no longer match regular expresions against fact values incorrectly. Previously (starting with 5.2.0) the "~" operator would end up trying to match the JSON-encoded representation of a fact value rather than the value itself. So, for example,

  ~ ^something

would fail when it should succeed, while

  ~ ^"something

would match.
QA Risk Assessment: Needs Assessment


The ~ operator treats dotted variables, e.g. parameters.ensure and facts.fqdn, as if their values were wrapped in double quotes.

Both of the following return thousands of records:

resources { type = 'File' and parameters.ensure ~ '^"file"$' }
resources { type = 'File' and parameters.ensure = 'file' }

The following returns no records:

resources { type = 'File' and parameters.ensure ~ '^file$' }

I initially reported this as PDB-3903 in PE 2018.1.0-rc14, but either I didn't understand the full scope of the problem, or it has gotten worse since then.

Comment by Eric Thompson [ 2018/06/20 ]

will this fix, implicitly, PE-24298?

edit: answering my own question: yes (according to Jon's investigation)

Comment by Kenn Hussey [ 2018/06/21 ]

Maggie Dreyer Eric Thompson can we please prioritize this as a Customer 0 issue?

Comment by Maggie Dreyer [ 2018/06/21 ]

I think for the time being Rob Browning is handling PDB prioritization, until he tells the rest of the team that he needs help. For the time being it sounded like he and Zak had a handle on it. But I'll keep an eye on it.

Generated at Sun Jul 12 22:07:32 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.