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

Bring the negation of PQL operators in line with other PE components

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Template:
    • CS Priority:
      Minor
    • CS Frequency:
      2 - 5-25% of Customers
    • CS Severity:
      2 - Annoyance
    • CS Business Value:
      3 - $$$$
    • CS Impact:
      Hide
      The way the parser works requires that you change from `!= hyperv` to `and ! fact.whatever = 'hyperv'`. This is an annoyance for customers who are used to the more normal notation used in every programming language we're aware of and the PE console.

      If the parser could react to those symbols with a clearer error message that indicates you need to move your not operator to as described above. Today it just throws the basic error message of available operators rather than giving you a hint that the not operator needs to be moved.
      Show
      The way the parser works requires that you change from `!= hyperv` to `and ! fact.whatever = 'hyperv'`. This is an annoyance for customers who are used to the more normal notation used in every programming language we're aware of and the PE console. If the parser could react to those symbols with a clearer error message that indicates you need to move your not operator to as described above. Today it just throws the basic error message of available operators rather than giving you a hint that the not operator needs to be moved.

      Description

      After working with the PE console, or most programming languages, a user may very well attempt a PQL query along the lines of:

       

      # puppet query 'inventory { facts.kernel = "Linux" and facts.virtual != "hyperv" }'
      

        

      Unfortunately, this will result in the error message:

       

      Error response 400 Bad Request from server: PQL parse error at line 1, column 54:inventory { facts.kernel = "Linux" and facts.virtual != "hyperv" }
                                                           ^
      Expected one of:is not null
      is null
      in
      =
      >
      <
      <=
      >=
      ~>
      ~
      

      The documentation at https://puppet.com/docs/puppetdb/5.1/api/query/v4/pql.html#boolean-operators states that the negation has to be with the boolean operator rather than the conditional operator, but this is not in line with other areas of PE.  Specifically the PE Console, where the negation operators !~ and != are available.

      It would be preferred that the PQL operators were the same as those seen in other parts of the product. 

      Alternately, it would be an improvement to pick up negation simply in the wrong spot and have the error message note that it needs to be moved.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              adam.bottchen Adam Bottchen
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support