Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-3930

PQL's ~ matches incorrectly on dotted variables

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: PDB 5.2.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:

      2018.2.0-rc2

    • Template:
    • Acceptance Criteria:
      Hide

      The following query returns records:

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

      Show
      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:
      Hide
      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.
      Show
      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:
      Hide
      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.
      Show
      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

      Description

      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.

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  rob.browning Rob Browning
                  Reporter:
                  daniel.parks Daniel Parks
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  15 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: