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

PQL's ~ matches incorrectly on dotted variables

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • PDB 5.2.2
    • None
    • PuppetDB
    • 2018.2.0-rc2

    • 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$' }
    • PuppetDB
    • Needs Assessment
    • Reviewed
    • 3 - 25-50% of Customers
    • 3 - Serious
    • 4 - $$$$$
    • 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.
    • Bug Fix
    • 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.
    • 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

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support